Search code examples
javascriptangularangular-clicontent-security-policysubresource-integrity

Subresource Integrity With Angular-Cli


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?


Solution

  • 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