0

我正在尝试grunt-contrib-compass在我的watch任务中包含对的调用,但它没有将任何已保存的更改注册到我的 .scss 文件中。 grunt compass工作正常,并按grunt watch预期记录对 *.php 的所有其他更改。一个人在这里做错了什么?

gruntfile.js:

module.exports = function(grunt) {
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-compass');
    grunt.initConfig({
        compass: {
            dev: {
                options: {
                    config: 'config.rb'
                } //options
            } //dev
        }, //compass
        watch: {
            options: { livereload: true },
            scripts: {
                files: ['/scripts/*.js'],
            }, //scripts
            sass: {
                files: ['/_sass/*.scss'],
                tasks: ['compass:dev']
            }, //sass
            html: {
                files: ['*.php']
            } //html
        } //watch
    }) //initConfig
    grunt.registerTask('default', 'watch');
} //exports

只是为了好玩,我的 config.rb:

css_dir = '/css'
sass_dir = '/_sass'
output_style = :nested
4

1 回答 1

0

你所有路径中的前导“/”都让你失望,删除它们(来自 gruntfile 和 config.rb):

watch: {
    options: { livereload: true },
    scripts: {
      files: ['scripts/*.js'],
    }, //scripts
    sass: {
      files: ['_sass/*.scss'],
      tasks: ['compass:dev']
    }, //sass
    html: {
      files: ['*.php']
    } //html
} //watch
于 2015-11-03T20:51:19.423 回答