gruntjsgrunt-contrib-sass

Running grunt and compiling sass to the same directory as source files


I have all of my scss under parent folder and I have a grunt task running to compile them.

With this particular project there won't be a build or output folder. I would like to have all of the scss files compile in their same directory.

+ folder + component - style.scss - style.css + another - style.scss - style.css

I have search high and low and can't find any examples of this. Is it even possible with Grunt?


Solution

  • Figured this out and wanted to post this just incase anyone else needed to achieve this.

    the cwd and dest need to be the same value.

    dist: {
                files: [{
                    expand: true, // Recursive
                    cwd: "<%= pathTo.Root %>", // The startup directory
                    src: '**/*.{sass,scss}', // Source files
                    dest: "<%= pathToRoot %>",
                    ext: ".css" // File extension 
                }]
            }