-1

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

下面编写的代码适用于完整的 scss 文件夹。

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

2 回答 2

0

它以以下格式工作:

compass: {
        dist: {
            options: {
                sassDir: 'src/scss',
                specify: 'src/scss/my_file.scss',
                cssDir: 'src/css',
            }
        }
    },
于 2017-12-08T08:20:41.920 回答
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'
        }
    }
},
于 2017-12-07T14:24:03.530 回答