grunt compass give single scss file

271 Views Asked by At

I am using grunt compass and I want only to compile a single scss file src/scss/image_slider.scss instead of all the files under scss folder.

Below written code works fine for full scss foler.

compass: {
        dist: {
            options: {
                sassDir: 'src/scss',
                cssDir: 'src/css',
            }
        }
    },
2

There are 2 best solutions below

0
On BEST ANSWER

It worked in below format:

compass: {
        dist: {
            options: {
                sassDir: 'src/scss',
                specify: 'src/scss/my_file.scss',
                cssDir: 'src/css',
            }
        }
    },
4
On

There is an option in grunt-contrib-compass https://github.com/gruntjs/grunt-contrib-compass#specify:

specify

Type: String|Array

Lets you specify which files you want to compile. 
Useful if you don't want to compile the whole folder. 
Globbing supported. Ignores filenames starting with underscore. 
Paths are relative to the Gruntfile.

So you should be able to to:

compass: {
    dist: {
        options: {
            sassDir: 'src/scss',
            cssDir: 'src/css',
            specify: 'myfile.scss'
        }
    }
},