简体   繁体   中英

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.

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

and in 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

Running "wiredep:target" (wiredep) task [D] Task source: /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.

If the grunt code posted is the actual content of your gruntfile, you're missing the grunt.initConfig() call.

This should work better :

module.exports = function( grunt ){

    grunt.loadNpmTasks('grunt-wiredep');

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

};

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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