咕噜咕噜的手表 - 只有在手表结束后才会编辑

时间:2014-04-04 15:50:16

标签: sass gruntjs grunt-contrib-watch

我不确定这是否是我的错误或错误配置,但是当使用grunt观看一些sass文件时,它肯定会监视文件,但只有当我退出观察者时才编译sass并更新目标文件。 / p>

这是我的观察节点:

watch: {
    sass : {
        files: [sassPath.scss],
        tasks: ['sass']
    }
}

例如,这是当前发生的事情:

 1. I do `grunt watch` on the command line
2. Start editing sass files
3. Command line notifies me that the change has been detected and it runs the sass task successfully
4. I manually look at the destination css file - no changes
5. ctrl + c to close the watcher while looking in the destination css file - i can see it updated as soon as the watch closes

我真的希望编译sass后立即更新目标css文件

1 个答案:

答案 0 :(得分:0)

是的,在某个更新中似乎有一个错误阻止你的gruntfile.js工作,我有同样的问题,并且通过composer更新后的一天文件刚停止工作,我不得不将手表部分更改为看起来像这样并修复它:

        // Watch for files and folder changes
    watch: {
        sass: {
            files: ['<%= options.sass.base %>/{,*/}*.{scss,sass}'],
            tasks: ['sass']
        },
        livereload: {
            options: {
                livereload: 35729,
            },
            files: [
                'app/views/*/*.php',
                '{tmp/<%= options.css.base %>,<%= options.css.base %>}/{,*/}*.css',
                '{tmp/<%= options.js.base %>,<%= options.js.base %>}/{,*/}*.js',
                '{tmp/<%= options.sass.base %>,<%= options.sass.base %>}/{,*/}*.css',
            ]
        },
        options: {
            livereload: true
        },
        files: '<%= options.watch.files %>',
        tasks: ['default', 'notify:watch']
    }