Skip to content

Instantly share code, notes, and snippets.

@aaronj1335
Last active December 20, 2015 21:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronj1335/6201527 to your computer and use it in GitHub Desktop.
Save aaronj1335/6201527 to your computer and use it in GitHub Desktop.
read the README.md
*.html
.jshintrc

grunt jade compiles all jade templates to individual html files.

grunt watch watches the jade files and automatically runs the grunt jade task.

the problem is the watch command recompiles all templates, even though only one changed. you can try it out:

git clone https://gist.github.com/6201527.git
cd 6201527
npm install
grunt watch &
touch one.jade
# notice that both one.jade and two.jade are compiled

is there a clean way to specify that only the corresponding jade template needs to be recompiled when one changes?

module.exports = function(grunt) {
grunt.initConfig({
jade: {
files: {
src: ['*.jade'],
dest: './',
expand: true,
ext: '.html'
}
},
watch: {
files: ['*.jade'],
tasks: ['jade']
}
});
grunt.loadNpmTasks('grunt-contrib-jade');
grunt.loadNpmTasks('grunt-contrib-watch');
};
{
"name": "how-would-u-say-i-do-this-anyway",
"version": "0.0.0",
"description": "read the readme",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": "",
"author": "",
"license": "BSD",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-watch": "~0.5.1",
"grunt-contrib-jade": "~0.8.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment