我的gulp任务中用于关键CSS的输出的目标文件夹不起作用

时间:2019-04-10 16:11:57

标签: gulp critical-css

我执行以下任务,然后将其运行到我的主题文件夹中以供wordpress使用:

gulp.task('critical-css', function () {
  return gulp.src('./style.css')
    .pipe(criticalCss({
      out: 'critical.php', // output file name
      url: 'http://localhost/dimoco/', 
        // url from where we want penthouse to extract critical styles
      width: 1400, // max window width for critical media queries
      height: 900, // max window height for critical media queries
      userAgent: 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)' 
        // pretend to be googlebot when grabbing critical page styles.
    }))
   .pipe(cssNano({
     safe:true // this isn't required, but I've included cssNano to minify the output file
   }))
  .pipe(gulp.dest('./template-parts/')); // destination folder for the output file
});

当我运行任务时,将写入一个具有关键CSS的文件,名为“ themenamecritical.php”。但是我想到了gulp代码:.pipe(gulp.dest('./ template-parts /'));一个名为critical.php的文件将被写入文件夹theme / template-parts /

那为什么不起作用?

最诚挚的问候

0 个答案:

没有答案