【问题标题】:Can't create targets within external sass Grunt task (with Grunt-Sass)无法在外部 sass Grunt 任务中创建目标(使用 Grunt-Sass)
【发布时间】:2014-12-05 23:31:43
【问题描述】:

我想创建这样的目标:

咕噜/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”之类的命令,从而创建多个模板。

【问题讨论】:

    标签: sass gruntjs


    【解决方案1】:

    能够通过将 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'
            }
        }
    };
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-04-16
      • 1970-01-01
      • 1970-01-01
      • 2014-05-27
      • 2017-10-15
      • 2017-04-16
      • 2012-09-29
      • 2015-12-24
      相关资源
      最近更新 更多