Reputation: 6742
Is there a way to replace variables with gulp inside HTML? In my case, I have development HTML files where are paths for images, for e.g. /assets/img/*.jpg
, but in production file I need those paths replace with ones which the CMS generates after file uploads. They are completely different and there isn't logic in folder names for e.g. /12365/586/*.jpg
.
Im looking for:
Dev HTML
variable_name_dev = "/assets/img"
variable_name_prod = "/12365/5698"
<img src="variable_name/bg.jpg" alt="Smiley face">
Generated Dev HTML
<img src="/assets/img/bg.jpg" alt="Smiley face">
Generated Production HTML
<img src="/12365/5698" alt="Smiley face">
Upvotes: 3
Views: 1822
Reputation: 523
How about gulp-inline-image-path? Or I've used gulp-token-replace for similar scenarios.
Upvotes: 3