如果我想在 diff 中注入 Js 文件。位置,例如<head> here
和here </body>
。我需要像这里描述的那样为注射设置名称:
https ://github.com/klei/gulp-inject#method-2-use-gulp-injects-name-option
<!-- head:js -->
<!-- only importantFile.js will be injected here -->
<!-- endinject -->
我怎样才能修改这个选择器,我不必为每个文件命名。例如,获取所有包含 *_important.js 的文件
.pipe(inject(gulp.src('./src/importantFile.js', {read: false}), {name: 'head'}))
有没有更好的方法。例如,喜欢添加 s.th。在 javascript 文件中或将其命名为 orderModule.above.js、googleAnalytics.below.js