New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-template-html-minifier

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-template-html-minifier - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

2

index.js

@@ -67,3 +67,3 @@ const htmlMinifier = require('html-minifier');

} while (value.indexOf(id) !== -1);
return '${' + id + ' }';
return 'babel-plugin-template-html-minifier:' + id;
}

@@ -70,0 +70,0 @@

{
"name": "babel-plugin-template-html-minifier",
"description": "Minify HTML in tagged template strings using html-minifier",
"version": "2.1.0",
"version": "2.1.1",
"main": "index.js",

@@ -6,0 +6,0 @@ "scripts": {

@@ -20,3 +20,6 @@ import test from 'ava';

const defaultHtmlMin = {
collapseWhitespace: true
collapseWhitespace: true,
removeComments: true,
minifyCSS: {level: 2},
minifyJS: true
};

@@ -30,2 +33,6 @@

const tickSpan2Trimmed = '`<span class="${classes}" readonly="readonly" disabled="${disabled}">test</span>`';
const tickSpan3 = '`<span style="${style}" >test</span>`';
const tickSpan3Trimmed = '`<span style="${style}">test</span>`';
const tickSpan4 = '`<span onclick=${() => console.log(\'click\')} >test</span>`';
const tickSpan4Trimmed = '`<span onclick=${()=>console.log(\'click\')}>test</span>`';
const tickComment = '`<!-- Comment with variable ${myclass} -->`';

@@ -91,2 +98,29 @@ /* eslint-enable no-template-curly-in-string */

test('templated style attribute', t => babelTest(t, {
source: `import {html} from 'lit-html';
html${tickSpan3};`,
result: `import{html}from'lit-html';html${tickSpan3Trimmed};`,
pluginOptions: {
modules: {
'lit-html': ['html']
},
htmlMinifier: defaultHtmlMin
}
}));
test('templated event attribute', t => babelTest(t, {
source: `import {html} from 'lit-html';
html${tickSpan4};`,
result: `import{html}from'lit-html';html${tickSpan4Trimmed};`,
pluginOptions: {
modules: {
'lit-html': ['html']
},
htmlMinifier: {
...defaultHtmlMin,
removeAttributeQuotes: true
}
}
}));
test('import of main module file by path specified in package.json', t => babelTest(t, {

@@ -93,0 +127,0 @@ source: `import {html, render} from 'lit-html/${litHtmlMain}';

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