Raf*_*gli 1 contains task watch gruntjs compass
我正在使用Grunt通过手表将我的SASS文件转换为CSS.
问题是:我可以正常运行Compass任务,CSS创建得非常好,但是当我使用WATCH时,我得到了错误:
grunt.util ._.contains不是函数
这是我的package.json:
{
"name": "myName",
"description": "myDesc",
"author": "mySelf",
"version": "0.0.1",
"private": true,
"devDependencies": {
"grunt": "^1.0.1",
"grunt-contrib-compass": "^1.1.1",
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-nodeunit": "~0.4.1",
"grunt-contrib-sass": "^1.0.0",
"grunt-contrib-uglify": "^0.5.1",
"grunt-contrib-watch": "^0.4.4"
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的Gruntfile.js:
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
compass: {
dist: {
options: {
config: 'config.rb'
}
}
},
watch: {
css: {
files: 'assets/**/*.{scss,sass}',
tasks: ['compass']
}
}
});
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default',['compass','watch']);
};
Run Code Online (Sandbox Code Playgroud)
我尝试了很多改变,但没有任何帮助
更新!
经过漫长的一夜,解决问题 ......请阅读我自己的答案
我解决了这个问题!^ 4.0 lodash版本已更改包含到包含,并grunt-contrib-watch使用旧的lodash语法.所以我在代码中只更改了一行.node_modules/grunt-contrib-watch/tasks/watch.js在第116行找到
:
旧线:
if(!grunt.util._.contains(target.options.event,'all')&&!grunt.util._.contains(target.options.event,status)){
新队:
if(!grunt.util._.includes(target.options.event,'all')&&!grunt.util._.includes(target.options.event,status)){
现在,带指南针/ SASS的手表就像一个魅力;)
我希望它对某人有所帮助!
| 归档时间: |
|
| 查看次数: |
833 次 |
| 最近记录: |