简而言之,我使用grunt cableep和useminPrepare。我想将一些Bower依赖项合并到单个文件中。

HTML标记

<!-- build:js js/vendor/libraries.min.js -->
  <!-- bower:js -->
  <script src="bower_components/jquery/dist/jquery.js"></script>
  <script src="bower_components/velocity/velocity.js"></script>
  <script src="bower_components/velocity/velocity.ui.js"></script>
  <!-- endbower -->
<!-- endbuild -->


Wiredep配置

    wiredep: {
        target: {
            src: [
                '<%= app %>/**/*.html'
            ],
            exclude: [
                'modernizr',
                'Tabslet',
                'velocity'
            ]
        }
    }


useMin和useMinPrepare配置

    useminPrepare: {
        html: ['<%= app %>/*.html'],
        options: {
            dest: '<%= dist %>'
        }
    },

    usemin: {
        html: ['<%= dist %>/**/*.html', '!<%= app %>/bower_components/**'],
        css: ['<%= dist %>/css/**/*.css'],
        options: {
            dirs: ['<%= dist %>']
        }
    },


问题在于在library.min.js中,仅包含jQuery。

最佳答案

您必须从wiredep 'velocity'中删除​​exclude:以解决您的问题。
此外,根据grunt-usemin文档,选项dirs:不存在,您可能想要表示assetsDirs:

https://www.npmjs.com/package/grunt-usemin

10-08 15:47