Socket
Socket
Sign inDemoInstall

babel-plugin-html-tag

Package Overview
Dependencies
16
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    babel-plugin-html-tag

Statically evaluates and minify tagged html`<..>` template literals into strings


Version published
Weekly downloads
75
decreased by-2.6%
Maintainers
1
Install size
4.03 MB
Created
Weekly downloads
 

Readme

Source

babel-plugin-html-tag

Statically evaluates and minifies tagged html`<..>` template literals into strings

npm tested with jest codecov node

What it does:

Minifies tagged template literals (by default using html tag) via html-minifier then removes the tag:

In:

const a = html`<p class="zoom center justify">
  This is paragraph with ${b} subsitutions at several lines: ${1 + 2}
</p>`;

const z = html`<table class="center">
  <tr class="left">
    <td>HTML without substitutions</td>
  </tr>
</table>`;

Out:

const a = `<p class="zoom center justify">This is paragraph with ${b} subsitutions at several lines: ${
  1 + 2
}</p>`;

// becomes static one line string if there is no substitutions
const z =
  '<table class="center"><tr class="left"><td>HTML without substitutions</td></tr></table>';

Tip

Try it with Visual Studio Code bierner.lit-html plugin for beautiful syntax highlight and HTML autocomplete inside tagged HTML string.

Credits

Inspired by babel-plugin-template-html-minifier and babel-plugin-graphql-tag

Keywords

FAQs

Last updated on 13 May 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc