我使用Yeoman安装了angular-generator
我未来的项目,我计划使用less
我有什么:
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']);
运行grunt之后,我有这个错误:
>> No "less" targets found.
Warning: Task "less" failed. Use --force to continue.
我如何解决这个问题?
答案 0 :(得分:0)
不确定您提到的是什么,但我使用以下内容并且它正在运行:
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'
}
}
},