【问题标题】:Grunt 'grunt-bower-concat', ignoring mainFiles optionGrunt 'grunt-bower-concat',忽略 mainFiles 选项
【发布时间】:2016-01-01 23:55:17
【问题描述】:

认识!

在过去的几个小时里,我一直试图让mainFiles 选项起作用,但它似乎忽略了我在其中包含的每个文件。我在列表中尝试了多个插件 - 但没有一个通过。诚然,我对 Grunt 很陌生,但我一直在浏览 grunt-bower-concat 文档,但那里什么也没有。并且在实际的插件代码中添加了一些控制台日志,显示没有文件被传递(当然之后恢复了文件)。

这是我正在使用的 GruntFile:

  module.exports = function(grunt) {

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    bower_concat: {
      main: {
        dest: 'Assets/Build/Scripts/plugins.js',
        cssDest: 'Assets/Build/Styles/plugins.css',
        dependencies: {
          'amplify': 'jquery'
        },
        mainFiles: {
          bootstrap: ['bower_components/bootstrap/dist/css/bootstrap.css']
        },
        exclude: [
          'leaflet-illustrate'
        ]
      }
    }
  });

  grunt.loadNpmTasks('grunt-bower-concat');

  grunt.registerTask('buildbower', ['bower_concat']);

};

Leaflet-Illustrate 已被排除(目前),因为它对实际任务造成严重破坏,并且没有 mainFiles 选项,我无法正确包含它。

有没有人可以以正确的方式指导我或纠正我? 提前致谢!

【问题讨论】:

  • 你试过在'bootstrap'周围加上引号
  • 我做了,可悲的是没有帮助:)

标签: javascript configuration gruntjs bower gruntfile


【解决方案1】:

事实证明,我输入了一个不需要的完整路径。意思是,这部分有效:

  main: {
    mainFiles: {
      'bootstrap': ['dist/css/bootstrap.css']
    }

【讨论】:

  • 而且您不必在引导程序周围使用引号 :-)
猜你喜欢
  • 1970-01-01
  • 2014-02-04
  • 1970-01-01
  • 2016-05-11
  • 2013-03-22
  • 1970-01-01
  • 1970-01-01
  • 2015-06-16
  • 2018-03-07
相关资源
最近更新 更多