O'Reilly logo

Continuous Integration, Delivery, and Deployment by Sander Rossel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Replacing HTML references

We now have only one problem left: our debug HTML is referencing scripts/bundles/some-bundle.js while our production build is referencing scripts/some-bundle.js. Additionally, we would like to replace some CSS files with the all.css file we created. We can replace patterns in our HTML using the gulp-html-replace module (https://www.npmjs.com/package/gulp-html-replace). For more generic string replacement, check out gulp-replace (https://www.npmjs.com/package/gulp-replace):

npm install gulp-replace --save-devnpm install gulp-html-replace --save-dev

All we have to do now is edit our views and indicate the parts we want to replace. This is from the index.html file:

<head>   <meta charset="UTF-8"> <title>CI Web Shop</title> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required