【发布时间】:2014-11-02 20:22:06
【问题描述】:
我的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'
}]
}
};
效果很好!唯一的问题是,我正在开发一个非常大的应用程序,我的玉文件超过 10mb。当我修改一个玉文件的视图并运行“咕噜玉”时。它重新编译了我所有的 html(大约需要 5 分钟)。我如何告诉 grunt 只编译相关的翡翠文件(只有一个 html 文件)
示例:我正在研究:
html_templates/views/module/landingpage2.jade
我只想编译:
html_templates/html/module/landingpage1.html
请帮忙
【问题讨论】:
-
这个问题有解决方案。在我的脑海中,“grunt newer”通过检查哪些文件已更新并仅处理这些文件来处理这个问题。
-
我也希望将其添加到 grunt watch。你用手表测试过这个吗?
-
是的,我用手表。您可以使用“watch”事件来识别已更改的文件,然后在 grunt Jade 配置中动态设置该路径。 (这在 grunt-contrib-watch README 中有描述。)我正在为我的自定义任务使用“watch”事件。见这里:codereview.stackexchange.com/questions/60949/…
-
正是我想要的!荣誉。
标签: javascript node.js express gruntjs pug