css - Foundation scss compass、gruntjs 和 bower 安装

标签 css sass gruntjs zurb-foundation compass-sass

可能与 scss: compass, gruntjs and bower install foundation - import path 翻倍

所以我有:

-models
-public
    ─bower_components
     ├───fastclick
     │   └───lib
     ├───foundation
     │   ├───css
     │   ├───js
     │   │   ├───foundation
     │   │   └───vendor
     │   └───scss
     │       └───foundation
     │           └───components

Gruntfile.js
package.json

我的 gruntfile.js

module.exports = function(grunt) {

    require('load-grunt-tasks')(grunt);

    grunt.initConfig({
      compass: {                  // Task
        dist: {                   // Target
          options: {              // Target options
            sassDir: 'public/scss',
            cssDir: 'public/stylesheets',
            environment: 'production',
            require: 'zurb-foundation',
            importPath: 'public/bower_components/foundation/scss',
            cacheDir: 'public/.sass_cache',
          }
        }
      },

      watch: {
        css: {
            files: ['public/scss/_settings.scss'],
            tasks: ['compass:dist'],
            option: { 
                spawn: false, 
                livereload: true
            }
        }
      }
    });

}

当我使用命令时:grunt compass

Running "compass:dist" (compass) task
Nothing to compile. If you're trying to start a new project, you have left off the directory argument.
Run "compass -h" to get help.

Done, without errors.

它不起作用... compass 不编译我的 scss...我该如何更正它?

最佳答案

我相信您必须注册您的任务。像这样:

module.exports = function(grunt) {

  // Configuration goes here
  grunt.initConfig({                  
    // blah
  });  

  // Define your tasks here
  grunt.registerTask('default', ['compass', 'watch']);
  grunt.registerTask('justCompass', ['compass']);
};

现在只需调用 grunt 来运行 compass 和 watch ,或者调用 grunt justCompass 来仅运行 compass 任务。

关于css - Foundation scss compass、gruntjs 和 bower 安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22456830/

相关文章:

javascript - 如何在 assetic 的 Symfony 中使用 CSS 和 JS 压缩

css - SCSS/SASS 数学错误?

css - 将字符串解析为 SASS 中的映射

javascript - 如何在全局scss文件中实现绝对路径? VueJS

javascript - 使用 grunt 找不到任务

jquery - 使用 jQuery 对图像进行分类

html - 如果没有固定大小,如何防止 DIV 换行?

css - 在清晰度数据网格单元格中居中内容

gruntjs - 将 bower 依赖项读入 grunt 文件列表

javascript - RequireJS 文本插件 - 缩小模板