5
votes

My Grunt setup is using sass to compile my .scss files to src/.css and cssmin to combine and minify my src/.css files to main.css.

I want to use the new sourcemap feature in SASS, but I'm not sure if it will really do anything for me considering cssmin will be putting all my css files into the main.css.

Does anyone have any insight into this?

I'm also, for now trying to turn off the sourcemap in grunt-contrib-sass and it won't take. Here's the relevant code in my Gruntfile.js:

sass: {
  dist: {
    options: {
      sourcemap: 'none'
    },
    files: [{
      expand: true,
      cwd: 'stylesheets/scss',
      src: ['**/*.scss'],
      dest: 'stylesheets/src',
      ext: '.css'
    }]
  }
},

from: github.com/gruntjs/grunt-contrib-sass

3
What version of grunt-contrib-sass are you using? You may need to upgrade. The package author answered a similar question here: github.com/gruntjs/grunt-contrib-sass/issues/153imjared
btw, you could use the output option with the compressed value to replace cssmin.Jack

3 Answers

8
votes

I just had this problem and the other solutions didn't help me. Here's how I fixed it:

options: {
  "sourcemap=none": ''
}

Using sass version 3.4.2, and npm update didn't help

0
votes

I ran into the same problem. As suggested in the above comment by @imjared, updating grunt-contrib-watch and grunt-contrib-sass did the trick.

https://www.npmjs.org/doc/cli/npm-update.html

-3
votes

Adding sourceMap: true as below solved the problem for me (NB: I'm using grunt.loadNpmTasks('grunt.sass')):

sass: {
  options: {
    includePaths: ['bower_components/foundation/scss'],
    imagePath: '/images'
  },
  dist: {
    options: {
      outputStyle: 'nested',
      sourceMap: true
    },
    files: [{
    expand: true,
            cwd: 'scss',
    src: ['[^_]*.scss'],
    dest: '../public/css/',
    ext: '.css'
    }]
  }
}

Hope that helps someone.