【发布时间】:2015-03-24 18:48:29
【问题描述】:
当我在终端中运行 grunt watch 任务时,它似乎在我修改文件时没有发现任何更改。
我不确定这是我的文件结构还是Gruntfile.js 中的配置。谁能告诉我我做错了什么?
sass: {
dist: {
options: {
style: 'compressed',
require: 'susy'
},
files: {
'app/styles/css/main.css': 'app/styles/sass/main.scss'
}
}
},
css: {
files: ['css/*.scss'],
tasks: ['sass'],
options: {
spawn: false,
}
},
watch: {
css: {
files: 'app/styles/sass/*.scss',
tasks: ['sass'],
options: {
livereload: true,
},
}
}
});
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-autoprefixer');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-sprite-generator');
grunt.registerTask('watchfiles', ['sass', 'watch' ]);
【问题讨论】:
-
你在命令行输入
grunt watchfiles或grunt watch? -
@KJPrice 是的,我忘了说
-
好吧,我认为
livereload需要根据documentation 进入options参数下。另外,我会确保这是您的 css“app/styles/css/”的正确路径。 -
@KJPrice 烦人,当我对我的 sass 文件进行更改时,我仍然没有看到终端中发生的操作
-
试试
grunt.registerTask('watchfiles', ['sass', 'watch:css' ]);
标签: javascript node.js gruntjs grunt-contrib-watch