Angular 2 CLI – Extract Hash Value

Hey, all! In this post, I’m just going to quickly show you how you could extract the hash that’s generated using angular 2’s CLI to build with the any of the productions build flags.

ng build --target=production --environment=prod
ng build --prod --env=prod
ng build --prod

For starters, why does cli add this random string in the generated files? The simple answer is what we call cache-busting. Leaving what cache is, and what it means to cache-bust for you to research on your own. So it’s great and all, but even if you’re using the cli, you’re not necessarily using its index.html file for anything. You might have your own way of inserting these generated files into your application. Which also means you’ll need to know the file name.

Read More