简体   繁体   English

grunt-jade-如何编译单个玉文件而不是所有文件

[英]grunt-jade - how to compile single jade file instead of everything

I have the following in my jade.js file 我的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'
  }]
 }
};

It is working great ! 效果很好! The only problem is that, i am working on a very large application and my jade files are over 10mb. 唯一的问题是,我正在处理一个非常大的应用程序,而我的玉文件超过10mb。 When i modify the view of one jade file and run 'grunt jade'. 当我修改一个玉器文件的视图并运行“ grunt jade”时。 It recompiles all my html (takes about 5 minutes). 它会重新编译我所有的html(大约需要5分钟)。 How to i tell grunt to only compile the relevant jade file(only one html file) 我该如何告诉grunt仅编译相关的玉文件(仅一个html文件)

Example: I am working on: 示例:我正在从事:

html_templates/views/module/landingpage2.jade

I want to compile only: 我只想编译:

html_templates/html/module/landingpage1.html

Please help 请帮忙

Use grunt-newer . 使用grunt-newer https://www.npmjs.org/package/grunt-newer https://www.npmjs.org/package/grunt-newer

Just install it and run your task as "newer:jade" and pretty much that's all. 只需安装它并以“ newer:jade”身份运行任务即可,仅此而已。

It also works with watch etc. 它还适用于手表等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM