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

reuse same verdor-xxx.{js, css} #127

Closed brucejcw closed 8 years ago

brucejcw commented 8 years ago

Can useref reuse the same builded file instead of re-doing build again?
I have about 10 files that using the same bower libs, but the gulp build seems too slowly, can useref check md5 or anyother symbol to check if is the same vendor file, and reuse it?

brucejcw commented 8 years ago

no one is here????

jonkemp commented 8 years ago

Yes someone is here. :smile: I'm not really sure I understand the question you are asking. There are ways to avoid doing the same things overtime with gulp. Please check these links.

https://github.com/gulpjs/gulp/blob/master/docs/recipes/incremental-builds-with-concatenate.md https://github.com/gulpjs/gulp/blob/master/docs/recipes/only-pass-through-changed-files.md https://github.com/gulpjs/gulp/blob/master/docs/recipes/rebuild-only-files-that-change.md

brucejcw commented 8 years ago

Thanks, I will see it.
My question is I have some files inject same libs,
for example: a.html, b.html, c.html, they all need same lib: bootstrap, jquery
Then the md5 of their vender.js/css must be the same,
So I want to reuse the vender.js/css, not build it three times

jonkemp commented 8 years ago

Post your gulpfile. Maybe someone here can help.

brucejcw commented 8 years ago

Very simple requirement, Assume that all my html files require same bower dependencies, and same build path: scripts/vendor.js, so at present, useref will build same vendor.js many times, override it each time, so how to let it build once and inject script tag vendor.js in each html 2015-08-21 12 40 46 2015-08-21 12 41 03 2015-08-21 12 41 44

jonkemp commented 8 years ago

You could do that with separate tasks for vendor.js and the html. One task could create the vendor.js and the useref task could just update the html. Useref can be used that way. It doesn't have to do all of it.

https://github.com/jonkemp/gulp-useref#usage