UNPKG

1.1 kBMarkdownView Raw
1# Crisper
2> Split inline scripts from an HTML file for CSP compliance
3
4## Usage
5
6Command line usage:
7
8 cat index.html | crisper -h build.html -j build.js
9 crisper --source index.html --html build.html --js build.js
10
11Library usage:
12
13 var output = crisper(htmlString, jsOutputFileName);
14 fs.writeFile(htmlOutputFileName, output.html, 'utf-8', ...);
15 fs.writeFile(jsOutputFileName, output.js, 'utf-8', ...);
16
17## Usage with Vulcanize
18
19When using [vulcanize](https://github.com/Polymer/vulcanize), crisper can handle
20the html string output directly and write the CSP seperated files on the command
21line
22
23 vulcanize index.html --inline-script | crisper --html build.html --js
24 build.js
25
26Or programmatically
27
28 vulcanize.process('index.html', function(err, html) {
29 if (err) {
30 return cb(err);
31 } else {
32 var out = crisper.split(html, jsFilename)
33 cb(null, out.html, out.js);
34 }
35 });
36
37## Build Tools
38
39- [gulp-crisper](https://npmjs.com/package/gulp-crisper)
40- *No grunt plugin yet, will you write it?*
41- *No broccoli plugin yet, will you write it?*