0.1.0 • Published 5 years ago
handlebars-csp-hash v0.1.0
What is this?
This is a simple handlebars helper which will generate a
Content-Security-Policy
hash for an inline script or style, which you can
drop into the header of your web page.
Usage
npm install handlebars-csp-hash
In your handlebars template:
<meta
http-equiv="Content-Security-Policy"
content="default-src 'self'; style-src 'self' '{{{ csp-hash "build/inline.css" }}}' 'unsafe-inline'"
>
Options
By default it will generate a SHA256, but you can also use SHA384 or SHA512
{{ csp-hash "build/inline.css" "sha384" }}
0.1.0
5 years ago