0.1.0 • Published 1 year ago

@anteris/parcel-transformer-html-literals v0.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Minifies HTML literals that Terser ignores.

About

This plugin takes template literals (such as Lit's) and minifies them. This helps ensure that using such literals does not increase the package size when using Parcel. For example:

import { css } from 'lit';

css`
  div {
    padding:20px;
  }
  
  h1 {
    padding:5px;
    color:purple;
  }
`;

Would become:

css`div{padding:20px}h1{padding:5px;color:purple}`;

Note: When the --no-optimize flag is passed to Parcel, your literals will not be minified.

Install

To install this transformer, add the following lines to your .parcelrc file:

{
  "extends": "@parcel/config-default",
  "transformers": {
      "*.{js,mjs,jsm,jsx,es6,cjs,ts,tsx}": [
          "@anteris/parcel-transformer-html-literals",
          "@parcel/transformer-babel",
          "@parcel/transformer-js",
          "@parcel/transformer-react-refresh-wrap"
      ],
  }
}

Note: It is important that @anteris/parcel-transformer-html-literals be the first transformer in the list.