-1

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',
            }
        }
    },
Varun Sukheja
  • 6,170
  • 5
  • 51
  • 93

2 Answers2

0

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'
        }
    }
},
Ivar
  • 4,350
  • 2
  • 27
  • 29
  • getting below error: Running "compass:dist" (compass) task `specify` option used, but no files were found. Warning: `binary` and `versionRange` required Use --force to continue. – Varun Sukheja Dec 07 '17 at 14:46
  • It tells you that could not find specified files: `specify option used, but no files were found`, make sure files are in expected location – Ivar Dec 07 '17 at 15:37
  • Yes I do know that and files are present at the specified location. – Varun Sukheja Dec 07 '17 at 16:51
  • If I give the sassDir then it compiles that sass file but the same filename when I give in specify it tell no files were found – Varun Sukheja Dec 07 '17 at 19:06
0

It worked in below format:

compass: {
        dist: {
            options: {
                sassDir: 'src/scss',
                specify: 'src/scss/my_file.scss',
                cssDir: 'src/css',
            }
        }
    },
Varun Sukheja
  • 6,170
  • 5
  • 51
  • 93