2015-07-21 35 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

    相關問題