Grunt:我如何看多个目录来编译scss文件?

时间:2015-08-09 17:19:39

标签: gruntjs

我正在使用Magento,我正在开展一个项目,其中module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), compass: { dist: { options: { sassDir: 'scss', cssDir: 'css' } } }, watch: { css: { files: '**/*.scss', tasks: ['compass'] } } //compassMultiple: { // multiple option provides you to compile multi sassDir. // all: { // options: { // multiple: [ // { // sassDir: 'scss', // cssDir: 'css' // },{ // sassDir: '../../barclays/default/scss', // cssDir: '../../barclays/default/css' // } // ] // } // } // } }); // grunt.loadNpmTasks('grunt-compass-multiple'); grunt.loadNpmTasks('grunt-contrib-compass'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.registerTask('default',['watch', 'compass']); } 个文件位于多个目录中。

我希望使用节点模块grunt-compass-multiple以便我可以实现这一点,但到目前为止我没有运气。

任何人都有任何想法如何同时观看多个目录,如果它们发生变化,可以编译其中的任何一个目录?

这是我目前的grunt文件:

'use strict';

executemany()

1 个答案:

答案 0 :(得分:0)

grunt-compass-multiple 完全符合您的需要。

https://www.npmjs.com/package/grunt-compass-multiple

grunt.initConfig({

  compassMultiple: {
    options : {
      // if you need, you can set options.
      environment: 'production',
      outputStyle: 'compressed',
      javascriptsDir: './js',
      imagesDir: './image',
      fontsDir: './font',
      importPath: './css/framework',
      relativeAssets: true,
      time: true
    },


    // multiple option provides you to compile multi sassDir.
    all: {
      options: {
        multiple: [
          {
          sassDir: 'page/css/cmn/',
          cssDir: '../static/page/css/cmn/'
          },{
          sassDir: 'page/css/orgn/scss',
          cssDir: '../static/page/css/orgn/'
          }
        ]
      }
    }
  }
});

来自:https://github.com/yoheiMune/grunt-compass-multiple

相关问题