我的 jade.js 文件中有以下内容
'use strict';
var config = require('../config');
module.exports = {
dist: {
options: {
pretty: true,
debug: false,
timestamp: '<%= new Date().getTime() %>'
},
files: [{
expand: true,
cwd: 'html_templates/views/',
src: '**/*.jade',
dest: 'html_templates/html/',
ext: '.html'
}]
}
};
效果很好!唯一的问题是,我正在处理一个非常大的应用程序,我的 jade 文件超过 10mb。当我修改一个 jade 文件的 View 并运行“grunt jade”时。它重新编译我所有的 html(大约需要 5 分钟)。我如何告诉 grunt 只编译相关的 jade 文件(只有一个 html 文件)
例子:我正在做:
html_templates/views/module/landingpage2.jade
我只想编译:
html_templates/html/module/landingpage1.html
请帮忙
最佳答案
使用 grunt-newer
。 https://www.npmjs.org/package/grunt-newer
只需安装它并以“newer:jade”运行您的任务即可。
它也适用于 watch 等。
关于javascript - grunt-jade - 如何编译单个 jade 文件而不是所有文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25744180/