I was wondering if anyone knew of a possible way to activate Subresource Integrety with Angular-Cli. According to the following link: GitHub Pull Request It would be a feature (or a future feature). I was hoping to activate it but it does not seem to be active on the current versions. Is there another way to use Subresource Integrety with Angular-Cli?
Thanks to the angular-cli team there is already an option to add the subresource integrity to your files by simply appending —subresource-integrity to your build script: Once the flag is added, the cli will automatically generate a hash for the application resources and add to the index.html when running npm run build:
Subresource Integrity. Jump to: Subresource Integrity (SRI) is a security feature that enables browsers to verify that resources they fetch (for example, from a CDN) are delivered without unexpected manipulation. It works by allowing you to provide a cryptographic hash that a fetched resource must match.
ng build link Compiles an Angular app into an output directory named dist/ at the given output path. Must be executed from within a workspace directory. ng build <project> [options]
Get Data from a Server Compiles an Angular app into an output directory named dist/ at the given output path. Must be executed from within a workspace directory. The command can be used to build a project of type "application" or "library".
Pass the --subresource-integrity
flag into your ng build command.
You can verify that it works by looking at your index.html file. You'll see the integrity attribute on linked stylesheets and scripts.
SRI requires v1.5.0+ of the CLI.
E.G. ng build --subresource-integrity
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With