首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >组件没有使用grunt-wiredep注入index.html文件。

组件没有使用grunt-wiredep注入index.html文件。
EN

Stack Overflow用户
提问于 2016-01-26 11:33:35
回答 1查看 137关注 0票数 0

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

代码语言:javascript
复制
grunt.loadNpmTasks('grunt-wiredep');
wiredep: {
  target: {
    src: 'index.html' // point to your HTML file.
  }
}

在index.html中

代码语言:javascript
复制
< !-- bower:js -->
< !-- endbower -->

在此之后,我安装任何图书馆通过保龄球类似。

代码语言:javascript
复制
bower install jquery --save

然后

代码语言:javascript
复制
grunt wiredep

在那之后我得到

➜dc-客户门户-spa git:(主)✗grunt wiredep -调试 运行"wiredep:target“(wiredep)任务D任务源: /var/www/dc-customer-portal-spa/node_modules/grunt-wiredep/tasks/wiredep.js 完成了,没有错误。

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

EN

回答 1

Stack Overflow用户

发布于 2016-01-26 15:16:15

如果发布的grunt代码是grunt文件的实际内容,那么您就缺少了grunt.initConfig()调用。

这应该更好地发挥作用:

代码语言:javascript
复制
module.exports = function( grunt ){

    grunt.loadNpmTasks('grunt-wiredep');

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

};
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35012892

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档