Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sass with grunt is not working

Tags:

sass

gruntjs

I have been trying to setup a grunt task to compile my sass files but nothing seems to be working.

My working structure is

  Gruntfile.js
  package.json
  assets
  |
  |--sass
  |  |
  |  styles.scss
  |
  |--css

and this is my grunt file

'use strict';

module.exports = function (grunt) {

grunt.initConfig({
    sass: {
        dist: {
            options: {
                style: 'expanded'
            },
            files: [{
                expand: true,
                cwd: 'assets/sass',
                src: ['*.scss'],
                dest: '../css',
                ext: '.css'
            }]
        }
    }
});
grunt.loadNpmTasks('grunt-sass');

grunt.registerTask('default', ['sass']);
};

I have already verified that I have sass installed

when I run grunt sass, it says that everything when okay. But I have yet to see a compiled css file. The only way that I got this to work is by using the "destination" : "source" syntax.

EDIT: The exact problem I'm having is not that the files are generating in the wrong place, but that they aren't generating. Also, grunt is not showing any errors

Does anyone have a clue as to what is wrong with this?

like image 599
alexdmejias Avatar asked Oct 10 '13 03:10

alexdmejias


1 Answers

This configuration works for me:

files: [{
    expand: true,
    cwd: 'assets/sass',
    src: ['**/*.scss'],
    dest: 'assets/css',
    ext: '.css'
}]

Perhaps the ../ is throwing it off; I don't believe the destination path is relative to the source path, it's relative to the Gruntfile.

like image 62
Ben Avatar answered Oct 03 '22 12:10

Ben