Using the Grunt Compass task to generate CSS product code without debugging information

I use Yeoman RC1.1 to create my project and grunt-contrib-compass is loaded to use Scss in my project.

When I do grunt build , the resulting CSS is minimized but populated with debug comments. It looks like this:

 @media -sass-debug-info{filename{font-family:file\:\/\/\/\/Users\/myname\/Sites\/project\/app\/components\/sass-bootstrap\/lib\/_reset\.scss}line{font-family... 

Where all this is polluted with a lot of -sass-debug-info code.

In Gruntfile.js, I set the following option (among many other options) to disable debugging comments for the / dist / css file:

 grunt.initConfig({ compass: { dist: { options: { debugInfo: false } } } } 

Am I debugInfo in debugInfo that turning off debugInfo by setting it to false should fix the problem?

+4
source share
4 answers

I encountered this error recently, the problem is that compass / grunt will not recompile your css file if there is no change in one of the files. You not only need to update debugInfo: false, but you will need to make changes to your scss file so that it recompiles your css file without the built-in debug line.

+1
source

Try syle compressed output https://github.com/gruntjs/grunt-contrib-compass#debuginfo and environment: production

0
source

You must change the value of debugInfo to false from true to compass.server.options.debugInfo

 compass: { options: { sassDir: '<%= yeoman.app %>/styles', cssDir: '.tmp/styles', generatedImagesDir: '.tmp/images/generated', imagesDir: '<%= yeoman.app %>/images', javascriptsDir: '<%= yeoman.app %>/scripts', fontsDir: '<%= yeoman.app %>/styles/fonts', importPath: '<%= yeoman.app %>/bower_components', httpImagesPath: '/images', httpGeneratedImagesPath: '/images/generated', httpFontsPath: '/styles/fonts', relativeAssets: false, assetCacheBuster: false, raw: 'Sass::Script::Number.precision = 10\n' }, dist: { options: { generatedImagesDir: '<%= yeoman.dist %>/images/generated' } }, server: { options: { //set degbugInfo false to produce css code without sass debugInfo debugInfo: false } } }, 
0
source

The Grunt component uses the cache located in ".tmp". You must clear this folder when you run the Grunt build task or execute it manually.

-one
source

Source: https://habr.com/ru/post/1492810/


All Articles