Wednesday, 15 June 2011

javascript - Compliling multiple folder from LESS to CSS using grunt watch? -



javascript - Compliling multiple folder from LESS to CSS using grunt watch? -

i trying compile less files using grunt watch, have 2 folders containing less files , 2 destination folders shows me error:

object has no method 'indexof;

gruntfile.js code:

module.exports = function(grunt) { grunt.initconfig({ less: { options: { paths: ["./less"], yuicompress: true }, files: [{ expand: true, cwd: './less', src: ['*.less', '!{fonts, variable, mixins}*.less'], dest: './css', ext: '.css' }, { expand: true, cwd: './less', src: '*.less/themes', dest: './css/themes', ext: '.css' }], }, watch: { files: "./less/*", tasks: ["less"] } }); grunt.loadnpmtasks('grunt-contrib-less'); grunt.loadnpmtasks('grunt-contrib-watch'); grunt.registertask('default', ['watch']); };

as u can see ;files:' alternative there includes 2 different folders.

i think should enclose in "mode" variable, such "development" or "production". this:

less: { development: { options: { paths: ["./less"], yuicompress: true }, files: [{ expand: true, cwd: './less', src: ['*.less', '!{fonts, variable, mixins}*.less'], dest: './css', ext: '.css' }, { expand: true, cwd: './less', src: '*.less/themes', dest: './css/themes', ext: '.css' }] } }

also, after "files" array, there unnecessary comma, removed in example...

update watch next afterward:

watch: { files: "./less/*", tasks: ["less:development"] }

javascript json gruntjs grunt-contrib-watch

No comments:

Post a Comment