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

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

本文关键字:html 文件 索引 注入 未使用 grunt-wiredep 组件      更新时间:2023-09-26

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

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

和索引.html

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

之后,我通过鲍尔喜欢安装任何库。

bower install jquery --save

然后

grunt wiredep

之后我得到了

➜ DC-客户-门户-水疗 git:(主) ✗ 咕噜咕噜 Wiredep --调试

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

完成,没有错误。

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

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

这应该工作得更好:

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