grunt-injector不注入文件

我正在使用grunt-injector来注入客户端依赖项。

以下是我的initConfig的“注入器”部分的外观:

"injector": { "options": { "template": "public/dist/index.html", "destFile": "public/dist/index.gen.html" }, "local_dependencies": { "files": { "public/dist/index.html": [ "public/**/*.js", "public/**/*.css" ] } } } 

和我的公共/ dist / index.html读取

 <!DOCTYPE html> <html> <head> <!-- injector:css--> <!-- endinjector--> </head> <body ng-cloak ng-app="primary"> <!-- injector:js--> <!-- endinjector--> </body> </html> 

我做到了

 grunt.loadNpmTasks("grunt-injector"); 

并注册“注射器”作为我的任务的一部分。

但是,执行grunt只会生成,而不是注入。 到“index.gen.html”文件。

我该怎么办? 有什么build议么?

问题是由尾随空间造成的。 由于我使用帕格(以前的翡翠)编译我的HTML,它是产生而不是(因为帕格相当于// injector:css )和尾部空间是由我的编辑器autoremoved。

添加

 "options": { "starttag": "<!-- injector:{{ext}}-->", "endtag": "<!-- endinjector-->" }, 

解决了这个问题