Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Concat and replace files #43

Open
nevf opened this issue Dec 21, 2015 · 3 comments
Open

Concat and replace files #43

nevf opened this issue Dec 21, 2015 · 3 comments

Comments

@nevf
Copy link

nevf commented Dec 21, 2015

With gulp-userref I can concat script files into one, minify the result and replace the script tags with the new minified script. I can't see how that is possible in gulp-html-replace - is it?

OTH gulp-html-replace will let me replace a block with something I specify and gulp-userref doesn't do this.

I need to be able to perform both of these tasks.

Thanks for very useful gulp plugin.

@jonatasleon
Copy link

+1

1 similar comment
@zRosenthal
Copy link

+1

@bmacnaughton
Copy link
Contributor

bmacnaughton commented Jan 17, 2017

I ended up writing gulp-markers because of this. I originally used gulp-html-replace but the code to handle optional file concatenation was convoluted and hard to maintain. gulp-markers is really a thin wrapper around RegExp.replace() that handles streams and buffers for gulp.

It's not as easy to use - you have to define your own markers (regular expressions) and replacements strings or function, just like RegExp replace. But it's this particular use, inserting non-concatenated files for development and concatenated files for production, that pushed me there.

If interested, here it is: https://github.com/bmacnaughton/gulp-markers/blob/master/README.md.

If you read to the bottom of my README you'll find that gulp-html-replace was what got me started down this whole path. I owe a debt to VFK for kicking this off and helping me get started in the whole area.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants