【问题标题】:connecting grunt-contrib-sass to yeoman and grunt-contrib-watch将 grunt-contrib-sass 连接到 yeoman 和 grunt-contrib-watch
【发布时间】:2023-03-12 05:14:01
【问题描述】:

非常类似于this question

我已经安装了节点库并将它放在我的package.json

"devDependencies": {
  ...
  "grunt-contrib-sass": "~0.6.0"
}

并在我的Gruntfile.js 中有一个块:

grunt.initConfig({
  ...
  sass: {
    dist: {
      files: [{
        expand: true,
        cwd: '<%= yeoman.app %>/styles/scss',
        src: ['scss/{,*/}*.scss'],
        dest: '<%= yeoman.app %>/styles/css',
        ext: '.css'
      }]
    }
  }

我的文件结构如下:

app
  styles
    css
    scss

我已经安装了 sass gem。

我确定我在这里遗漏了一些非常基本的东西,需要包含在内。我的yo serve 似乎没有将文件放在正确的位置以供查找和使用。

我想我在 watch 块中缺少一些东西,但我不确定那是什么。

【问题讨论】:

    标签: javascript node.js gruntjs yeoman grunt-contrib-watch


    【解决方案1】:

    所以我的Gruntfile.js 需要看起来像这样:

        sass: {
          dist: {
           files: [{
             expand: true,
             cwd: '<%= yeoman.app %>/styles/scss',
             src: ['*.scss'],
             dest: '.tmp/styles/',
             ext: '.css'
           }]
         }
       }
    

    我需要将sass 添加到watch 块中的样式任务中。

    【讨论】:

      猜你喜欢
      • 2015-01-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-12
      • 1970-01-01
      • 1970-01-01
      • 2014-11-19
      • 2017-10-15
      相关资源
      最近更新 更多