【问题标题】:Foundation scss compass, gruntjs and bower install基础 scss 指南针、gruntjs 和 bower 安装
【发布时间】:2014-04-22 19:17:21
【问题描述】:

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.

它不起作用...指南针不编译我的 scss...我该如何纠正?

【问题讨论】:

    标签: css sass gruntjs zurb-foundation compass-sass


    【解决方案1】:

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

    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 任务。

    【讨论】:

      【解决方案2】:

      除了注册你的任务,你还需要阅读 package.json 文件。

      module.exports = function(grunt) {
        grunt.initConfig({
          pkg: grunt.file.readJSON('package.json')
          // all the other code
        });
      };
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2014-02-15
        • 1970-01-01
        • 2013-04-12
        • 2014-04-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多