【问题标题】:Component is not injecting in index.html file using grunt-wiredep组件未使用 grunt-wiredep 注入 index.html 文件
【发布时间】:2016-01-26 11:33:35
【问题描述】:

这是我的代码,它查找组件并将它们直接注入到 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

之后我得到了

➜ dc-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文件中,请指导我。

【问题讨论】:

    标签: javascript gruntjs bower grunt-wiredep


    【解决方案1】:

    如果发布的 grunt 代码是 gruntfile 的实际内容,则您缺少 grunt.initConfig() 调用。

    这应该会更好:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-11
      相关资源
      最近更新 更多