咕噜指南针给单个scss文件

时间:2017-12-07 14:04:42

标签: sass gruntjs compass-sass compass grunt-contrib-compass

我正在使用grunt指南针,我只想编译单个scss文件src/scss/image_slider.scss而不是scss文件夹下的所有文件。

下面编写的代码适用于完整的scss foler。

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

2 个答案:

答案 0 :(得分:0)

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.

所以你应该能够:

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

答案 1 :(得分:0)

它采用以下格式:

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