gulp-useref
gulp-useref copied to clipboard
does not work with <!-- inject:js --> or <!-- inject:js -->
<!-- build:js js/app.js -->
<!-- inject:js -->
<script src="/src/app/app.module.js"></script>
<script src="/src/app/home/home.module.js"></script>
<script src="/src/app/products/product.module.js"></script>
<script src="/src/app/home/home.directives.js"></script>
<script src="/src/app/products/product.services.js"></script>
<script src="/src/app/products/productDetail.controller.js"></script>
<script src="/src/app/products/productEdit.controller.js"></script>
<script src="/src/app/products/productList.controller.js"></script>
<script src="/src/app/common/services/common.services.js"></script>
<script src="/src/app/common/services/product.services.mock.js"></script>
<!-- endinject -->
<!-- inject:templates:js -->
It works without inject:xx but not with
here's my code
gulp.task('optimize', ['inject'], function () {
var assets = $.useref.assets({ searchPath: './' });
var templateCache = config.temp + config.templateCache.file;
return gulp
.src(config.index)
.pipe($.plumber())
.pipe($.inject(gulp.src(templateCache, {
read: false,
starttag: '<!-- inject:templates:js -->'
})))
.pipe(assets) // Gathers assets from html comments
.pipe(assets.restore()) // Restores the files to the stream. ex: index.html
.pipe($.useref()) // $.useref(): concatenates all files
.pipe(gulp.dest(config.dist));
});
This would be an issue for the https://github.com/digisfera/useref repo. However, https://github.com/taptapship/wiredep might be an alternative solution that would work.
@eugenekgn my guess is this doesn't work because the comments are stripped out. Can you confirm this?