Generate Hash for Inline Script while using Chrome Extensions due to Content Security Policy (CSP) errpr ❌
Because I faced this problem while making Meta Preview
Just replace the script
variable in index.js
with the contents of your inline script & run index.js
If your inline script is like -
<script>alert('Yo Yo Yo!')</script>
then replace script
variable in index.js
like -
const script = `alert('Yo Yo Yo!')`;
& type in terminal
node index.js
Voila, it will copy the hash to the clipboard.
All the credits go to https://stackoverflow.com/a/38554505/6141587
I just tweaked a little to copy it to clipboard :)