Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

crisper

Package Overview
Dependencies
Maintainers
3
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

crisper - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

3

index.js

@@ -38,2 +38,3 @@ /**

var onlySplit = options.onlySplit || false;
var alwaysWriteScript = options.alwaysWriteScript || false;

@@ -64,3 +65,3 @@ var doc = dom5.parse(source);

if (!onlySplit) {
if (contents.length > 0) {
if (contents.length > 0 || alwaysWriteScript) {
var newScript = dom5.constructors.element('script');

@@ -67,0 +68,0 @@ dom5.setAttribute(newScript, 'src', jsFileName);

{
"name": "crisper",
"version": "1.1.0",
"version": "1.2.0",
"description": "Make an HTML file with inline scripts CSP compliant",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -19,6 +19,8 @@ # Crisper

file
- `--always-write-script`: Always create a .js file, even without any `<script>`
elements.
Library usage:
var output = crisp({
var output = crisper({
source: 'source HTML string',

@@ -34,3 +36,3 @@ jsFileName: 'output js file name.js',

var output = crisp.split('source HTML string', 'output js filename.js');
var output = crisper.split('source HTML string', 'output js filename.js');

@@ -65,3 +67,3 @@ ## Usage with Vulcanize

- [gulp-crisper](https://npmjs.com/package/gulp-crisper)
- *No grunt plugin yet, will you write it?*
- [grunt-crisper](https://www.npmjs.com/package/grunt-crisper)
- *No broccoli plugin yet, will you write it?*

@@ -78,2 +78,27 @@ /**

suite('No JS produces empty script when forced', function() {
var obj;
setup(function() {
obj = crisp({
source: '<body>Hello World</body>',
jsFileName: 'foo.js',
alwaysWriteScript: true
});
});
test('js property is the empty string', function() {
assert.ok(obj.js === "");
});
test('output js is linked via <script> in the output html <body>', function() {
var doc = dom5.parse(obj.html);
var outscript = dom5.query(doc, pred.AND(
pred.hasTagName('script'),
pred.hasAttrValue('src', 'foo.js')
));
assert.ok(outscript);
});
});
suite('script defer\'d in head', function() {

@@ -80,0 +105,0 @@ var obj;

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc