9

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?

Alex L
  • 119
  • 1
  • 11

1 Answers1

12

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

Taul
  • 2,113
  • 1
  • 14
  • 18
  • Unfortunately I won't be able to test this soon so if anyone has success with this solution please let me know so I can mark this as the answer :). – Alex L Mar 22 '18 at 14:00
  • 1
    `--subresource-integrity` flag is only available for the build command, not serve – lightswitch05 Jul 11 '18 at 01:31
  • I feel like it used to work on a serve command. Maybe it did when I wrote the answer. But when I try it now the CLI puts a note in the console that it ignores that SRI flag. I'll update the answer accordingly. – Taul Mar 26 '19 at 18:31
  • 1
    That is true for just about everything in the modern web. If possible, I recommending encouraging your customers, users, and/or management to stop using or supporting IE. (Good luck.) – Taul May 16 '19 at 16:44