Note that there are some explanatory texts on larger screens.

plurals
  1. POGrunt: Watch multiple files, Compile only Changed
    primarykey
    data
    text
    <p>I'm new to Grunt, and so far I'm enjoying it very much. I want Grunt to compile only the changed files when running <code>grunt watch</code></p> <p>In my Grunfile.coffee I currently have (relevant parts).<br> <em>Note: assets/javascript/app.coffee and assets/javascript/app.js are directories</em> </p> <pre><code> coffee: default: expand: true cwd: "assets/javascript/app.coffee" src: ["*.coffee"] dest: "assets/javascript/app.js" ext: ".js" uglify: dev: options: beautify: true compress: false mangle: false preserveComments: 'all' files: "js/app.js": "assets/javascript/app.js/*.js" "js/libs.js": "assets/javascript/libs/*.js" watch: coffeescript: files: 'assets/javascript/**/*.coffee' tasks: ["coffee"] javascript: files: "assets/**/*.js" tasks: ["uglify:dev"] livereload: files: ["Gruntfile.coffee", "js/*.js", "*.php", "css/*.css", "images/**/*.{png,jpg,jpeg,gif,webp,svg}", "js/*.js", ] options: livereload: true </code></pre> <p>There is probably a shorter way around, but I'm compiling app.coffee to app.js first, so that after I distribute my work, people who aren't comfortable with Coffeescript can browse the code in somewhat reasonable manner.</p> <p>The problem with all this is that now that I save a Coffeescript file, I get too many steps ( I think ):</p> <pre><code>&gt;&gt; File "assets/javascript/app.coffee/browse.coffee" changed. Running "coffee:default" (coffee) task File assets/javascript/app.js/browse.js created. File assets/javascript/app.js/filters.js created. Done, without errors. Completed in 0.837s at Tue May 28 2013 12:30:18 GMT+0300 (EEST) - Waiting... OK &gt;&gt; File "assets/javascript/app.js/browse.js" changed. &gt;&gt; File "assets/javascript/app.js/filters.js" changed. Running "uglify:dev" (uglify) task File "js/app.js" created. File "js/libs.js" created. Done, without errors. Completed in 0.831s at Tue May 28 2013 12:30:19 GMT+0300 (EEST) - Waiting... OK &gt;&gt; File "js/app.js" changed. &gt;&gt; File "js/libs.js" changed. Completed in 0.000s at Tue May 28 2013 12:30:19 GMT+0300 (EEST) - Waiting... </code></pre> <p>Currently I'm just setting up my project, but I will have a lot more Coffeescript files, and I don't want Coffeescript to recompile all of the files, on each file change.</p> <p>Furthermore, libs.js has no part in all of this at all, but I guess it is still compiled, because it also matches the "assets/*<em>/</em>.js" pattern.</p> <p>Is there a way to make Grunt compile only the files that have changed ?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload