[英]Grunt and Less. No «less» targets found?
我安裝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']);
少運行咕unt聲后,我出現此錯誤:
>> No "less" targets found.
Warning: Task "less" failed. Use --force to continue.
我該如何解決?
不知道您所說的是什么,但我正在使用以下內容,並且可以正常工作:
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'
}
}
},
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.