【发布时间】:2013-12-06 13:41:02
【问题描述】:
这是我的Gruntfile.js
watch: {
options: { livereload: true },
compass: {
files: ['assets/sass/*.{scss,sass}'],
tasks: ['compass']
},
// js: {
// files: '<%= jshint.all %>',
// tasks: ['jshint', 'uglify']
// },
livereload: {
// files: ['*.html', '*.php', 'assets/stylesheets/**/*.{css}']
files: ['*.html', '*.php', 'assets/stylesheets/custom.css']
}
},
// compass and scss
compass: {
dist: {
options: {
config: 'config.rb',
force: true
}
}
},
这是grunt watch的输出:
Done, without errors.
... Reload assets/sass/custom.scss ...
... Reload assets/stylesheets/custom.css ...
Completed in 11.033s at Fri Dec 06 2013 14:20:48 GMT+0100 (CET) - Waiting...
OK
>> File "assets/stylesheets/custom.css" changed.
>> File "assets/sass/custom.scss" changed.
Running "compass:dist" (compass) task
overwrite assets/stylesheets/custom.css (0.701s)
identical assets/stylesheets/app.css (3.452s)
Compilation took 4.158s
Done, without errors.
... Reload assets/sass/custom.scss ...
... Reload assets/stylesheets/custom.css ...
Completed in 10.719s at Fri Dec 06 2013 14:21:53 GMT+0100 (CET) - Waiting...
- ..so,为什么 livereload 需要这么多时间来刷新页面, 10 秒预览我的 .scss 文件中的任何更改,以及它会如何 可能不完全刷新页面,但只注入 .css 更改 在页面中?
- ..我想知道的另一件事是如何避免这种情况 app.css 上的编译延迟,几乎花了 4 秒,但不是 甚至改变了?
我正在使用带有此配置的 livereload 浏览器扩展。
谢谢。
【问题讨论】:
-
我也注意到了性能问题,所以我很好奇这里的任何解决方案。
标签: performance gruntjs livereload