How can I prevent Compass from dumping .sass-cache folder using Grunt

I have a .sass-cache folder that is automatically generated. Trying to figure out how to prevent it from generating it at all. To be more clear, I don't want the .sass-cache folder.

I've tried several approaches but couldn't seem to get it to generate.

Here's a couple trying:

  • noCache: false or true
  • config.rb file with: asset_cache_buster =: none
  • config.rb file with: cache = false

This is what my watch is doing:

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'],
    }
},

      

and then, this is what Compass does and a snippet of my tasks:

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']
);
};

      

here is what i am trying in my config.

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

      

+3


source to share


2 answers


The setting cache = false

in yours config.rb

should be sufficient. You can try disabling all caching:

asset_cache_buster = :none
cache = false

      



If that doesn't work, you can always run a cleanup to delete the folder. (see link)

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

+3


source


If you are running Sass from the command line, you can add a flag --no-cache

:



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

+1


source







All Articles