Name: crisper
Owner: PolymerLabs
Description: null
Created: 2015-04-07 22:53:01.0
Updated: 2018-03-14 17:17:14.0
Pushed: 2017-08-01 21:57:14.0
Homepage: null
Size: 48
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Split inline scripts from an HTML file for CSP compliance
Command line usage:
index.html | crisper -h build.html -j build.js
per --source index.html --html build.html --js build.js
per --html build.html --js build.js index.html
The output html file will load the output js file at the top of <head>
with a <script defer>
element.
Optional Flags:
--script-in-head=false
<body>
document.write
support.--only-split
<script>
tag in the output HTML
file.--always-write-script
<script>
elements.--csp-hashable-script-loader
pt-src 'strict-dynamic' 'sha256-mUZwR5zj1qMvnzisSvfmC8JczLB0BUKW0Ohr3euDoIA=';
ct-src 'none';
-uri 'self';
-v
| --version
Library usage:
output = crisper({
urce: 'source HTML string',
FileName: 'output js file name.js',
riptInHead: true, //default true
lySplit: false, // default false
waysWriteScript: false // default false
riteFile(htmlOutputFileName, output.html, 'utf-8', ...);
riteFile(jsOutputFileName, output.js, 'utf-8', ...);
When using vulcanize, crisper can handle the html string output directly and write the CSP separated files on the command line
anize index.html --inline-script | crisper --html build.html --js build.js
Or programmatically
anize.process('index.html', function(err, cb) {
(err) {
return cb(err);
else {
var out = crisper({
source: html,
jsFileName: 'name of js file.js',
scriptInHead: true, // default true
onlySplit: false, // default false
alwaysWriteScript: false //default false
})
cb(null, out.html, out.js);
split
API was removedrequire('crisper').split()
script-in-head
flag changed to truedocument.write
calls--script-in-head=false
argument or
scriptInHead: false
in library usage.