组件未使用grunt-wiredep在index.html文件中注入

时间:2016-01-26 11:33:35

标签: javascript gruntjs bower grunt-wiredep

这是我的代码,它查找组件并将它们直接注入INDEX.HTML文件。

grunt.loadNpmTasks('grunt-wiredep');
wiredep: {
  target: {
    src: 'index.html' // point to your HTML file.
  }
}

和index.html

< !-- bower:js -->
< !-- endbower -->

之后我通过凉亭安装任何库。

bower install jquery --save

然后

grunt wiredep

之后我得到了

  

➜cd-customer-portal-spa git :( master)✗gruntwiredep --debug

     

运行“wiredep:target”(wiredep)任务[D]任务来源:   /var/www/dc-customer-portal-spa/node_modules/grunt-wiredep/tasks/wiredep.js

     

完成,没有错误。

但不包含在html文件中,请指导我。

1 个答案:

答案 0 :(得分:0)

如果发布的grunt代码是gruntfile的实际内容,那么你就错过了grunt.initConfig()调用。

这应该更好:

module.exports = function( grunt ){

    grunt.loadNpmTasks('grunt-wiredep');

    grunt.initConfig({
        wiredep: {
            target: {
                src: 'index.html' // point to your HTML file.
            }
        }
    });

};
相关问题