Reputation:
So, I've recently started using Grunt, and it's working! Great.
As I use LESS, I decided I want development and production version of the compiled CSS - so I decided to add in the relevant targets. However, I'm now getting the error specified in the title.
I've looked at StackOverflow, and a lot of the solutions are regarding the [] around the 'files' option(is that the right word?), which I lack. I don't know where in the file I need to add them, and I've tried some places and it doesn't work.
Adding [] to the 'src' option I have doesn't work either.
Here's the first part of my Gruntfile - I don't believe the rest is needed.
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
less: {
production: {
options: {
path: ["css"],
cleancss: true
},
src: {
expand: true,
cwd: "css/",
src: ['*.less', '!_*.less'],
dest: "production/css/",
ext: ".css"
}
},
dev: {
options: {
path: ["css"]
},
src: {
expand: true,
cwd: "css/",
src: ['*.less', '!_*.less'],
dest: "css/",
ext: ".css"
}
}
},
Thanks! I'm sorry in advance if this question is a repeat, but nothing else gives me any hints.
Upvotes: 0
Views: 1511
Reputation: 11305
Have you tried setting the files in the same way as the docs? This specifies the source files slightly differently to how you have it:
less: {
development: {
options: {
paths: ["assets/css"]
},
files: {
"path/to/result.css": "path/to/source.less"
}
},
production: {
options: {
paths: ["assets/css"],
cleancss: true,
modifyVars: {
imgPath: '"http://mycdn.com/path/to/images"',
bgColor: 'red'
}
},
files: {
"path/to/result.css": "path/to/source.less"
}
}
}
See the usage examples in the docs for more clarification: https://github.com/gruntjs/grunt-contrib-less#usage-examples
Upvotes: 1