无法在外部sass Grunt任务中创建目标(使用Grunt-Sass)

时间:2014-12-05 14:39:13

标签: sass gruntjs

我想创建这样的目标:

咕噜/ sass.js:

'use strict';

module.exports = {
    alpha: {
        options: {
            includePaths: ['bower_components/foundation/scss']
        },
        dist: {
            options: {
                outputStyle: 'compressed'
            },
            files: {
                'css/app.css': 'scss/app2.scss'
            }
        }
    }
};

Gruntfile.js:

module.exports = function (grunt) {
require('load-grunt-config')(grunt);
};

我无法正常工作。只有当我将sass.js文件重新编码为以下Grunt时,才将其编译为CSS:

module.exports = {
  options: {
    includePaths: ['bower_components/foundation/scss']
  },
  dist: {
    options: {
    outputStyle: 'compressed'
    },
  files: {
    'css/app.css': 'scss/app.scss'
    }
  }
};

如何创建这些目标,以便执行'grunt sass:alpha'之类的命令,这样我就可以创建多个模板。

1 个答案:

答案 0 :(得分:0)

能够通过将grunt / sass.js改为此来解决它:

'use strict';

module.exports = {
    options: {
        includePaths: ['bower_components/foundation/scss']
    },
    alpha: {
        options: {
            outputStyle: 'compressed'
        },
        files: {
            'css/alpha.css': 'scss/app_alpha.scss'
        }
    },
    beta: {
        options: {
            outputStyle: 'compressed'
        },
        files: {
            'css/beta.css': 'scss/app_beta.scss'
        }
    }
};