我正尝试在watch任务中包含对grunt-contrib-compass的调用,但它没有将任何已保存的更改注册到我的.scss文件中。grunt compass运行良好,grunt watch会按照预期记录对*.php的所有其他更改。一个人在这里做错了什么?
gruntfile.js:
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.initConfig({
compass: {
dev: {
options: {
config: 'config.rb'
} //options
} //dev
}, //compass
watch: {
options: { livereload: true },
scripts: {
files: ['/scripts/*.js'],
}, //scripts
sass: {
files: ['/_sass/*.scss'],
tasks: ['compass:dev']
}, //sass
html: {
files: ['*.php']
} //html
} //watch
}) //initConfig
grunt.registerTask('default', 'watch');
} //exports为了好玩,我的config.rb:
css_dir = '/css'
sass_dir = '/_sass'
output_style = :nested发布于 2015-11-04 04:51:19
你所有路径中的前导'/‘会让你迷失方向,删除它们(从gruntfile和config.rb中):
watch: {
options: { livereload: true },
scripts: {
files: ['scripts/*.js'],
}, //scripts
sass: {
files: ['_sass/*.scss'],
tasks: ['compass:dev']
}, //sass
html: {
files: ['*.php']
} //html
} //watchhttps://stackoverflow.com/questions/33401886
复制相似问题