i have following gruntfile.js. bootstrap.less file has tons of imports includes plugins' css codes well. therefore, bootstrap takes 5-20 seconds compile whenever make change less files. there way can have 2 different less tasks, whenever there's change in of bootstrap's imported files, runs less task associated bootstrap , other task run if main.less changed.
module.exports = function(grunt) { // project configuration. grunt.initconfig({ pkg: grunt.file.readjson('package.json'), less: { development: { options: { paths: ["../css"] }, files: { "../css/bootstrap.css": "../less/bootstrap.less", "../css/main.css": "../less/main.less" } } }, watch: { options: { livereload: true }, less: { options: { livereload: false, spawn: false }, files: ['../less/*.less', '../less/responsive/*.less'], tasks: ['less'] }, css: { files: ['../css/main.css'], tasks: [] } } }); // less grunt.loadnpmtasks('grunt-contrib-less'); // watch grunt.loadnpmtasks('grunt-contrib-watch'); };
try running code :
module.exports = function(grunt) { // project configuration. grunt.initconfig({ pkg: grunt.file.readjson('package.json'), less: { development: { options: { paths: ["../css"] }, files: { "../css/main.css": "../less/main.less" } }, bootstrapbuild : { options : { paths: ['../css'] }, files : { "../css/bootstrap.css": "../less/bootstrap.less", } } }, watch: { options: { livereload: true }, maincss: { options: { livereload: false, spawn: false }, files: ['../less/*.less', '../less/responsive/*.less', '!../less/bootstrap.less'], tasks: ['less: development'] }, bootstrapbuild : { files: ['../less/bootstrap.less'], tasks: ['less:bootstrapbuild'] }, css: { files: ['../css/main.css'], tasks: [] } } }); // less grunt.loadnpmtasks('grunt-contrib-less'); // watch grunt.loadnpmtasks('grunt-contrib-watch'); };
Comments
Post a Comment