Get unlimited public & private packages + team-based management with npm Teams.Learn more »

handlebars-csp-hash

0.1.0 • Public • Published

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" }}

Install

npm i handlebars-csp-hash

DownloadsWeekly Downloads

1

Version

0.1.0

License

MIT

Unpacked Size

2.27 kB

Total Files

3

Last publish

Collaborators

  • avatar