咕噜指南针和手表编写缓慢 [英] Grunt with Compass and Watch compiles slow
问题描述
Grunt编译css文件需要很长时间,我不确定这是否正常,但普通罗盘手表大约需要5秒。
所以问题是,如果有什么办法可以加快Grunt的编译时间,还是更好地坚持罗盘观看?
运行compass:dist(指南针)任务
不变images / sprite-sf580a96666.png
覆盖样式表/ app.css (3.263s)
不变图片/ sprite-sf580a96666.png
覆盖样式表/app_fr.css(3.289s)
编译花费11.116s
运行watch任务
2013年12月18日星期三13:53:05 GMT-0500(东部标准时间 - 等待...
OK
>>文件scss \_core .scss已更改。
Gruntfile.js:
指南针:{
dist:{
选项:{
config:'config.rb'
}
}
},
watch:{
sass:{
files:['scss / *。scss'],
tasks:['compass: dist'],
选项ns:{
spawn:false,
}
},
scripts:{
files:['js / *。js'],
tasks :['concat','uglify'],
options:{
spawn:false,
}
}
}
} );
c> watch 选择grunt-contrib-compass,可以使用 grunt-concurrent 运行两个过程,实际上 grunt watch
和指南针手表
,并列:
concurrent:{
watch:{'b $ b tasks:['watch','compass:watch'],
选项:{
logConcurrentOutput:true
}
}
},
指南针:{
watch:{
options:{
watch:true
}
}
}
如果您想在构建,部署或其他任何需要 compile
而不是 watch
的Grunt中运行指南针,你需要做第二个指南针任务并使用它:
compass:{
// Compass grunt模块需要一个带有选项的命名目标属性。
编译:{
options:{}
}
}
Grunt takes a quite long to compile the css file, I am not sure if this is normal but regular compass watch takes around 5 seconds.
So the question is if there is any way to speed up the compilation time with Grunt or is it better to just stick with compass watch?
Running "compass:dist" (compass) task
♀unchanged images/sprite-sf580a96666.png
overwrite stylesheets/app.css (3.263s)
unchanged images/sprite-sf580a96666.png
overwrite stylesheets/app_fr.css (3.289s)
Compilation took 11.116s
Running "watch" task
Completed in 13.974s at Wed Dec 18 2013 13:53:05 GMT-0500 (Eastern Standard Time- Waiting...
OK
>> File "scss\_core.scss" changed.
Gruntfile.js:
compass: {
dist: {
options: {
config: 'config.rb'
}
}
},
watch: {
sass: {
files: ['scss/*.scss'],
tasks: ['compass:dist'],
options: {
spawn: false,
}
},
scripts: {
files: ['js/*.js'],
tasks: ['concat', 'uglify'],
options: {
spawn: false,
}
}
}
});
Along with what Simon mentioned about the watch
option of grunt-contrib-compass, you can use grunt-concurrent to run two processes, effectively grunt watch
and compass watch
, alongside each other:
concurrent: {
watch: {
tasks: ['watch', 'compass:watch'],
options: {
logConcurrentOutput: true
}
}
},
compass: {
watch: {
options: {
watch: true
}
}
}
If you want to run compass from Grunt when building, deploying, or anything else that requires compile
instead of watch
, you'll need to make a second compass task and use that:
compass: {
// Compass grunt module requires a named target property with options.
compile: {
options: {}
}
}
这篇关于咕噜指南针和手表编写缓慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!