0

I'm using grunt-contrib-css to process my sass files, this is the workflow im following:

  • partial.sass contains all the styles.
  • home.sass import partial.sass.
  • home.css gets created from home.sass.
  • home.min.css is the minified version of home.css, and the one included on the .html file.

However, the map for home.min.css points to home.css but what I need is the map to be related to the partial file. is this possible?

PD: I'm using grunt-contrib-sass to process the sass file and grunt-contrib-cssmin to minify the css.

miguelopezv
  • 790
  • 2
  • 8
  • 28

1 Answers1

0

you don't need use grunt-contrib-cssmin to minify your css, grunt sass task does that.

use style: "compressed", to get a minified file and style: "expanded", for debuging with line number

bellow a sample for you solve this.

gruntfile.js

     //src ===============================
        var src;
        config.src = src = {
            sassMain: 'scss/home.sass',
            distFolder: 'public/stylesheets/app.dist.css',
            devFolder: 'public/stylesheets/app.dev.css',
            sassFolder: 'scss/**/*.sass'
        };

        //Sass ===============================
            var sass;
            config.sass = sass = {};

            //distribution
            sass.dist = {
                options: {
                    style: "compressed",
                    noCache: true,
                    sourcemap: 'none',
                    update: true
                },
                files: {
                    "<%= src.distFolder %>": "<%= src.sassMain %>"
                }
            };

            //development env.
            sass.dev = {
                options: {
                    style: "expanded",
                    lineNumber: true,
                },
                files: {
                    "<%= src.devFolder %>": "<%= src.sassMain %>"
                }
            };

grunt.registerTask('dev', ['concat:dev', 'sass:dev']);
    grunt.registerTask('dist', ['concat:dev', 'sass:dist']);

I hope this can help you.

raduken
  • 2,091
  • 16
  • 67
  • 105