1.1.7 • Published 2 months ago

rollup-plugin-minify-template-literals v1.1.7

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

rollup-plugin-minify-template-literals API Docs

Minify HTML & CSS markup inside JavaScript/TypeScript template literal strings - for vite and rollup.

Installation

$ npm i rollup-plugin-minify-template-literals
# or
$ yarn add rollup-plugin-minify-template-literals
# or
$ pnpm add rollup-plugin-minify-template-literals

Usage

Vite

import { defineConfig } from "vite";
import { minifyTemplateLiterals } from "rollup-plugin-minify-template-literals";

export default defineConfig({
  plugins: [minifyTemplateLiterals()],
});

Rollup

import { minifyTemplateLiterals } from "rollup-plugin-minify-template-literals";

export default {
  plugins: [minifyTemplateLiterals()],
};

ES5 Support

Be sure to minify template literals before transpiling to ES5. Otherwise, the API will not be able to find any template literal (${}) strings.

Options

export interface Options {
  /**
   * Pattern or array of patterns of files to minify.
   */
  include?: string | string[];
  /**
   * Pattern or array of patterns of files not to minify.
   */
  exclude?: string | string[];
  /**
   * Minify options, see
   * https://github.com/explodingcamera/esm/tree/main/packages/minify-literals#options.
   */
  options?: Partial<minify.Options>;
  /**
   * If true, any errors while parsing or minifying will abort the bundle
   * process. Defaults to false, which will only show a warning.
   */
  failOnError?: boolean;
  /**
   * Override minify-html-literals function.
   */
  minifyHTMLLiterals?: typeof minify.minifyHTMLLiterals;
  /**
   * Override include/exclude filter.
   */
  filter?: (id: string) => boolean;
}

Related Packages

  • minify-literals - Minify HTML & CSS markup inside JavaScript/TypeScript template literal strings.

Credits

This package is based on rollup-plugin-minify-html-literals by Elizabeth Mitchell. I've fixed a few bugs, ported it to ES modules, and refactored it a bit.

1.1.7

2 months ago

1.1.6

3 months ago

1.1.5

3 months ago

1.1.4

5 months ago

1.1.3

8 months ago

1.1.2

10 months ago

1.1.1

12 months ago

1.0.2

1 year ago

1.1.0

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

1.0.3

1 year ago

0.2.1

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.2.0

1 year ago

0.1.0

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago