简体   繁体   English

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

[英]Component is not injecting in index.html file using grunt-wiredep

Here is my code which finds components and injects them directly into the INDEX.HTML file. 这是我的代码,该代码查找组件并将它们直接注入INDEX.HTML文件。

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

and in index.html 并在index.html中

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

after that i install any library via bower like. 之后,我通过凉亭安装任何库。

bower install jquery --save

and then 接着

grunt wiredep

after that i got 之后,我得到了

➜ dc-customer-portal-spa git:(master) ✗ grunt wiredep --debug ➜dc-customer-portal-spa git:(master)✗grunt wireep --debug

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

Done, without errors. 完成,没有错误。

But not included in html file, Kindly guide me. 但不包括在html文件中,请指导我。

If the grunt code posted is the actual content of your gruntfile, you're missing the grunt.initConfig() call. 如果发布的grunt代码是gruntfile的实际内容,则说明缺少grunt.initConfig()调用。

This should work better : 这应该更好地工作:

module.exports = function( grunt ){

    grunt.loadNpmTasks('grunt-wiredep');

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

};

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM