How to use less-plugin-clean-css with grunt-contrib-less?
I'm trying to use less-plugin-clean-css with grunt-contrib-less but I can't seem to get it to work. It seems grunt config can't find or install the plugin. This is for the bootstrap fork I support.
I have updated Gruntfile.js with
grunt.initConfig({
...
less: {
compileCore: {
options: {
strictMath: true,
sourceMap: true,
outputSourceFiles: true,
+ plugins: [
+ (new require('less-plugin-clean-css')({
+ "advanced": true,
+ "compatibility": "ie8"
+ }))
+ ],
sourceMapURL: '<%= pkg.name %>.css.map',
sourceMapFilename: 'dist/css/<%= pkg.name %>.css.map'
},
src: 'less/bootstrap.less',
dest: 'dist/css/<%= pkg.name %>.css'
...
}
},
Plugin installed:
npm install less-plugin-clean-css --save-dev
Run grunt
and get this error:
Running "less:compileCore" (less) task
>> TypeError: Cannot read property 'install' of undefined
What am I missing?
+3
source to share