Skip to content

Instantly share code, notes, and snippets.

@squalltua
Created May 5, 2016 15:10
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 squalltua/0f4db30d874f4c56d3bbbb3bc071209d to your computer and use it in GitHub Desktop.
Save squalltua/0f4db30d874f4c56d3bbbb3bc071209d to your computer and use it in GitHub Desktop.
sample Gruntfile.js for watching and compiling less files.
'use strict';
module.exports = function (grunt) {
// load all grunt tasks
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.initConfig({
watch: {
// if any .less file changes in directory "public/css/" run the "less"-task.
files: "public/css/*.less",
tasks: ["less"]
},
// "less"-task configuration
less: {
// production config is also available
development: {
options: {
// Specifies directories to scan for @import directives when parsing.
// Default value is the directory of the source, which is probably what you want.
paths: ["public/css/"],
},
files: {
// compilation.css : source.less
"public/css/app.css": "public/css/app.less"
}
},
},
});
// the default task (running "grunt" in console) is "watch"
grunt.registerTask('default', ['watch']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment