我对grunt,less和文件观看有轻微问题。我用grunt编译我的较少的代码到压缩的css代码。我的代码工作正常只有一分钟,然后进程将无法编译我的文件,我必须关闭我的mac上的终端并再次启动grunt进程。休息之后,你会发现我的Gruntfile.js和我的终端读数。
我希望你能帮助我:)谢谢你的时间! 最好的问候!
Gruntfile.js:
module.exports = function(grunt) {
grunt.initConfig({
less: {
development: {
options: {
compress: true,
yuicompress: true,
optimization: 2
},
files: {
"assets/css/style.css": "assets/less/style.less"
}
}
},
watch: {
styles: {
files: ['assets/**/*.less'],
tasks: ['less:development'],
options: {
nospawn: true
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', [ 'less:development', 'watch' ]);
};
终端:
Running "less:development" (less) task
File assets/css/style.css created.
Running "watch" task
Waiting...OK
>> File "assets/less/style.less" changed.
Running "less:development" (less) task
File assets/css/style.css created.
Running "watch" task
Completed in 0.012s at Sat Feb 22 2014 23:50:05 GMT+0100 (CET) - Waiting...
OK
>> File "assets/less/style.less" changed.
Running "less:development" (less) task
File assets/css/style.css created.
Running "watch" task
Completed in 0.014s at Sat Feb 22 2014 23:50:21 GMT+0100 (CET) - Waiting...
OK
>> File "assets/less/style.less" changed.
Running "less:development" (less) task
File assets/css/style.css created.
Running "watch" task
Completed in 0.014s at Sat Feb 22 2014 23:50:25 GMT+0100 (CET) - Waiting...