node.js - gulp-jade能否使用gulp-cache
PHPz
PHPz 2017-04-17 15:37:54
0
2
543

最近在研究gulp插件的用法,而且公司内部使用的也是gulp自动化构建,使用jade预编译语言进行html内容的构建。当项目规模越来越大,文件数量累计到一定程度后,每一次编译html都要花很久的时间,经常在执行编译html任务就要耗费20秒-30秒的时间,这很影响效率。想请问gulp-cache配合jade能否配合使用?

PHPz
PHPz

学习是最好的投资!

reply all(2)
黄舟

gulp-newer only builds changed files

迷茫

It can be used, as long as it is a file, it can be cached.

The following is from my previous actual project, you can try it

var TYPE = 'DEV';
var VIEWS = ["src/views/**/*.jade"];

gulp.task("compile-views", function() {
  var config = (TYPE == 'DEV') ? { time: "" } : { time: "?v=" + new Date().getTime() };
  config.type = TYPE;
  return gulp.src(VIEWS)
    .pipe(cached("debug", { optimizeMemory: true }))
    .pipe(jade({ locals: config }))
    .on("error", function(error) {
      console.dir(error);
      this.emit('end');
    })
    .pipe(gulp.dest(FOLDER + APP));
});
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!