0

不确定这是否是我的错误或错误配置,但是当使用 grunt 监视一些 sass 文件时,它肯定会监视文件,但仅在我退出监视程序时编译 sass 并更新到目标文件。

这是我的监视节点:

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 文件

4

1 回答 1

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']
    }
于 2014-04-04T19:35:03.323 回答