I'm installed angular-generator
using Yeoman for my future project where I plan to use less
What I have:
npm install grunt-contrib-less --save-dev
Gruntfile.js
watch: {
tests: '<%= nodeunit.tests %>',
tasks: 'default',
styles: {
files: ['app/styles/less/*.less'], // which files to watch
tasks: ['less']
}
},
less: {
development: {
options: {
paths: ["app/styles/less"],
yuicompress: true
},
files: {
// target.css file: source.less file
"app/styles/main.css": "app/styles/less/main.less"
}
}
},
grunt.loadNpmTasks('grunt-contrib-less');
grunt.registerTask('default', ['jshint', 'clean', 'copy', 'useminPrepare', 'ngtemplates', 'concat', 'uglify', 'cssmin', 'usemin', 'nodeunit', 'less']);
After running grunt less, I have this error:
>> No "less" targets found.
Warning: Task "less" failed. Use --force to continue.
How I can fixing this?
Not sure of what you mentioned but I am using the following and it is working:
watch {
..,
less: {
files: ['<%= config.app %>/styles/{,*/}*.less'],
tasks: ['less']
},
},
....
less: {
production: {
options: {
paths: ['dist/styles'],
cleancss: false
},
files: {
'.tmp/styles/main.css': 'app/styles/main.less'
}
}
},
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.