【问题标题】:Why is Grunt ignoring my file paths?为什么 Grunt 会忽略我的文件路径?
【发布时间】:2014-07-10 18:44:27
【问题描述】:

我在一个 git 子模块中有整个 bootstrap-sass 项目。当我只告诉它查看 sass/bootstrap/vendor 时,为什么 grunt 会查看 sass/bootstrap/test/ 并且失败了?

'use strict';
module.exports = function(grunt) {
  grunt.initConfig({
    compass: {
      dist: {
        options: {
          sassDir: 'sass',
          cssDir: 'style'
        },
        files: {
          'style/bootstrap.css': 'sass/bootstrap/vendor/assets/stylesheets/bootstrap.scss'
        }
      }
    },
    watch: {
      sass: {
        files: [
          'sass/bootstrap/vendor/assets/stylesheets'
        ],
        tasks: ['compass']
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-compass');
  grunt.loadNpmTasks('grunt-contrib-watch');

  grunt.registerTask('default', [
    'compass',
    'watch'
  ]);
};

$ grunt:

Running "compass:dist" (compass) task
directory style/bootstrap/templates/project/
directory style/bootstrap/test/dummy_sass_only/
directory style/bootstrap/test/dummy_node_mincer/
directory style/bootstrap/vendor/assets/stylesheets/
directory style/bootstrap/vendor/assets/stylesheets/bootstrap/
directory style/bootstrap/test/dummy_rails/app/assets/stylesheets/
    error sass/bootstrap/templates/project/styles.sass (Line 1: File to import not found or unreadable: bootstrap-compass.

【问题讨论】:

    标签: twitter-bootstrap sass gruntjs compass-sass


    【解决方案1】:

    grunt-contrib-compass 与其他 grunt 任务不同,因为您不指定单个文件。 Compass 是一个框架,它有自己的文件解析约定。所以任务grunt-contrib-compass只是提供了一个通过Grunt配置Compass的接口。

    查看 grunt-contrib-compass 文档中的用法示例:https://github.com/gruntjs/grunt-contrib-compass#example-config

    【讨论】:

    • 如果你想单独编译 sass 文件,请使用grunt-contrib-sass。指南针没有解决方法,它是一个框架。
    猜你喜欢
    • 2019-04-16
    • 1970-01-01
    • 2014-06-15
    • 2017-09-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-28
    • 1970-01-01
    相关资源
    最近更新 更多