【问题标题】:Why doesn't work this sass task in my gruntfile.js?为什么在我的 gruntfile.js 中这个 sass 任务不起作用?
【发布时间】:2019-02-12 21:58:29
【问题描述】:

这个任务不做任何事情:

sass: {
  options: {
    style: 'expanded',
    sourceMap: true,
    importer: compass
    //includePaths: sassLib
  },
  dist: {
    files: [{
      expand: true,
      cwd: 'scss',
      src: ['globbed/style.scss'],
      dest: 'css',
      ext: '.style.css'
    }]
  }
},

但这是可行的,它将style.scss 编译为style.css

sass: {
  dist: {
    files: {
      'css/style.css': 'scss/globbed/style.scss',
    }
  }
}

我应该在第一个任务中修改什么?

【问题讨论】:

    标签: sass gruntjs


    【解决方案1】:

    尝试将options 对象移动到dist 之一。或者,由于您使用的是 Compass,您可以尝试使用 grunt-contrib-compass 模块以获得更简单的方法。在您的情况下,代码可能是:

    // ...
    compass: {
        compile: {
            options: {
                sassDir: "scss",
                cssDir: "css",
                relativeAssets: true,
                outputStyle: "expanded"
            }
        }
    },
    // ...
    

    【讨论】:

      猜你喜欢
      • 2015-02-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多