fmal / gulp-inline-source

Inline flagged js & css sources.
MIT License
212 stars 31 forks source link

Feature request: Can you add an option for CSP SHA hashes to be generated automatically? #35

Closed riklewis closed 6 years ago

riklewis commented 7 years ago

It would be really handy when inlining javascript and styles for the CSP SHA256 hash to be generated and added as an attribute automatically.

For more information, look here... https://scotthelme.co.uk/csp-cheat-sheet/#hashes

fmal commented 6 years ago

@riklewis I believe you can utliize https://github.com/popeindustries/inline-source#custom-handlers for that. Use something like https://nodejs.org/api/crypto.html to compute checksum and then set your custom source.replace with the attribute in the handler.