2015-07-21 36 views
3

我有一个自动生成的.sass-cache文件夹。试图弄清楚如何不让它产生它。更清楚的是,我不需要.sass-cache文件夹。如何防止Compass使用Grunt输出.sass-cache文件夹

我已经尝试了几种方法,但似乎无法阻止它生成。

这里有一对夫妇试图办法:

  • NOCACHE:asset_cache_buster =:无
  • config.rb文件:高速缓存=假
虚假或真实
  • config.rb文件

    以下是我的手表在做什么:

    module.exports = function (grunt) { 
    grunt.initConfig({ 
    pkg: grunt.file.readJSON('package.json'), 
    
    watch: { 
        scripts: { 
         files: ['assets/js/*.js'], 
         tasks: ['concat', 'uglify', 'copy', 'clean'], 
         options: { 
          spawn: false 
         } 
        }, 
        scss: { 
         files: ['assets/scss/*.scss'], 
         tasks: ['compass', 'cssmin'], 
        } 
    }, 
    

    再后来,这里是罗盘是做&我的任务片段:

    compass: { 
        development: { 
         options: { 
          config: './config.rb', 
          sassDir: 'assets/scss', 
          cssDir: 'assets/css' 
         } 
        } 
    }, 
    
    clean:{ 
        build: { 
        } 
    } 
    }); 
    grunt.loadNpmTasks('grunt-contrib-watch'); 
    grunt.loadNpmTasks('grunt-contrib-less'); 
    grunt.loadNpmTasks('grunt-contrib-compass'); 
    grunt.loadNpmTasks('grunt-contrib-concat'); 
    grunt.loadNpmTasks('grunt-contrib-cssmin'); 
    grunt.loadNpmTasks('grunt-contrib-uglify'); 
    grunt.loadNpmTasks('grunt-contrib-copy'); 
    grunt.loadNpmTasks('grunt-contrib-clean'); 
    grunt.registerTask('default', ['watch']); 
    grunt.registerTask(
        'build', 
        'Compiles all the assets and copies the files to the build directory.', 
        ['less', 'compass', 'cssmin', 'concat', 'uglify', 'copy', 'clean'] 
    ); 
    }; 
    

    这里就是我想在我的配置。

    if File.file?('./.nosasscache') 
        asset_cache_buster = :none 
        cache = false # Uncomment to disable cache. 
    end 
    
  • 回答

    3

    设置cache = falseconfig.rb应该够了。你可以尝试禁用所有缓存:

    asset_cache_buster = :none 
    cache = false 
    

    如果不工作,你总是可以运行一个干净删除的文件夹(见链接)

    https://github.com/gruntjs/grunt-contrib-compass#clean

    +0

    它仍然没有发生。我甚至在终端内尝试过,干净的罗盘,它仍然会生成.sass-cache文件夹。我也尝试添加指南针干净作为一项任务,但似乎没有工作。我显然做得不对。我也确定我终止了终端任务并开始备份,以确保更改生效。 – JonnyBorg

    1

    如果从运行萨斯在命令行中,你可以添加--no-cache标志:

    sass --no-cache input.scss output.css

    相关问题