Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/tfs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Gruntjs 使用Grunt Watch将SASS转换为CSS时发生致命错误_Gruntjs_Task_Contains_Watch_Compass - Fatal编程技术网

Gruntjs 使用Grunt Watch将SASS转换为CSS时发生致命错误

Gruntjs 使用Grunt Watch将SASS转换为CSS时发生致命错误,gruntjs,task,contains,watch,compass,Gruntjs,Task,Contains,Watch,Compass,我正在使用Grunt通过watch将我的SASS文件转换为CSS 问题是:我可以正常运行Compass任务,CSS创建得非常好,但是当我使用WATCH时,我得到了错误: grunt.util.\ux.contains不是函数 这是我的包.json: { "name": "myName", "description": "myDesc", "author": "my

我正在使用Grunt通过watch将我的SASS文件转换为CSS

问题是:我可以正常运行Compass任务,CSS创建得非常好,但是当我使用WATCH时,我得到了错误:

grunt.util.\ux.contains不是函数

这是我的
包.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"
    }
}
这是我的
grunfile.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']);
};
我尝试了很多改变,但没有任何帮助

更新

经过一个漫长的夜晚,解决了这个问题。。。请阅读我自己的答案


我解决了这个问题!^4.0
lodash
版本已将包含更改为包含,并且grunt contrib watch使用了旧的lodash语法。所以我只修改了代码中的一行。发现
node\u模块/grunt contrib watch/tasks/watch.js
第116行:

老一套:

如果(!grunt.util.包含(target.options.event,'all')&&!grunt.util.包含(target.options.event,status)){

新行:

如果(!grunt.util.包括(target.options.event,'all')&&!grunt.util.包括(target.options.event,status)){

现在,带有指南针/SASS的手表工作起来就像一个符咒;)


我希望它能帮助别人!

我解决了这个问题。^4.0
lodash
版本已将contains更改为includes,而
grunt contrib watch
使用了旧的lodash语法。因此我只更改了代码中的一行。查找
node\u模块/grunt contrib watch/tasks/watch.js
第116行:

老一套:

如果(!grunt.util.包含(target.options.event,'all')&&!grunt.util.包含(target.options.event,status)){

新行:

如果(!grunt.util.包括(target.options.event,'all')&&!grunt.util.包括(target.options.event,status)){

现在,带有指南针/SASS的手表工作起来就像一个符咒;)

我希望它能帮助别人