jonkemp / gulp-useref

Parse build blocks in HTML files to replace references to non-optimized scripts or stylesheets.
MIT License
705 stars 93 forks source link

How to use gulp-bless with gulp-useref. #206

Closed santosguilherme closed 8 years ago

santosguilherme commented 8 years ago

I would use the gulp-bless plugin to separate bower CSS files, because the generated minified file is too long and isn't processed completely in IE 9.

But the file generated by gulp-bless plugin isn't replaced in the "index.html" file by gulp-useref plugin.

The gulp useref plugin also can't join all files, would keep the structure generated by the gulp-bless plugin.

Someone has any idea?

More details: http://stackoverflow.com/questions/37005513/how-to-user-gulp-bless-with-gulp-useref

jonkemp commented 8 years ago

Please post a sample gulpfile or a link to a repo where sample (or actual) code can be inspected. Thanks.

santosguilherme commented 8 years ago

The link on StackOverflow has examples, but here is the part of build task:

...
.pipe($.filter('**/*.css', { restore: true }))
.pipe($.sourcemaps.init())
.pipe($.minifyCss({ processImport: false }))
.pipe(bless())
.pipe($.sourcemaps.write('maps'))
.pipe(cssFilter.restore)
.pipe(assets.restore())
.pipe($.useref())
.pipe($.revReplace())

...

Part of useref tags on index.html:

...
<!-- build:css(src) css/vendor.css -->
<!-- bower:css -->
<!-- endbower -->
<!-- endbuild -->

<!-- build:css(src) css/app.css -->
<!-- inject:css -->
<!-- endinject -->
<!-- endbuild -->
...
santosguilherme commented 8 years ago

Solved by removing the sourceMap.