Compile less files with grunt-contrib-less won't work
The glob pattern js/base/*.css
does not match any files, therefore there is no destination. Usually, tasks like this expect multiple inputs to combine into a single output. Also, bear in mind that less
is a multi-task, and putting files
as a child of less
is not doing what you expect. (it is treating it as a target, not a src/dest map)
If you want a 1-1 transform of .less into .css, you can use dynamic expansion. (or you can define each src/dest pair manually, but who wants to do that?)
In your case:
less: { options: { paths: ['js/base'] }, // target name src: { // no need for files, the config below should work expand: true, cwd: "js/base", src: "*.less", ext: ".css" }}
I used Anthonies solution but stil had an error
Warning: Object true has no method indexOf
If I changed the order putting expand true
as second it gave me the error
Unable to read "less" file
where "less" was the value of the first item in my list.
I solved it by changing files into an array like this:
less: { options: { paths: ["js/base"] }, files: [{ expand: true, cwd: "js/base", src: ["**/*.less"], dest: "js/base", ext: ".css" }]},
I used "grunt-contrib-less" : "^0.11.0"