Registry / devops / rollup-plugin-fast-tagged-templates

rollup-plugin-fast-tagged-templates

JSON →
library1.0.3jsnpmunverified

A Rollup plugin that minifies and compresses tagged template literals for FAST Element (FAST) HTML and CSS templates. Version 1.0.3 is current and stable. It uses html-minifier-terser for HTML templates and a custom CSS minifier that removes whitespace and comments. Key differentiators: supports html, css, css.partial, and html.partial() tagged templates; allows disabling compression per type; accepts custom minification functions; designed specifically for FAST Element projects. Use after TypeScript transpilation to avoid breaking template expressions.

npm install rollup-plugin-fast-tagged-templates
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-FAST
R
rollup-plugin-fast-tagged-templates
devopsjavascriptv1.0.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import fastTaggedTemplates from 'rollup-plugin-fast-tagged-templates'
const fastTaggedTemplates = require('rollup-plugin-fast-tagged-templates')
The package is ESM-only (no CommonJS export). Use import statement.
fastTaggedTemplates
import fastTaggedTemplates from 'rollup-plugin-fast-tagged-templates'
import { fastTaggedTemplates } from 'rollup-plugin-fast-tagged-templates'
The plugin is exported as a default export, not a named export. Do not use destructuring braces.
options type (TypeScript)
import type { Options } from 'rollup-plugin-fast-tagged-templates'
For TypeScript users, the package ships type definitions. Use import type for type-only imports.

Configures Rollup with TypeScript transpilation and FAST tagged template compression. Shows how to set minifyHTMLOptions and disable CSS minification.

import { rollup } from 'rollup'; import fastTaggedTemplates from 'rollup-plugin-fast-tagged-templates'; import typescript from '@rollup/plugin-typescript'; rollup({ input: 'src/index.ts', plugins: [ typescript(), fastTaggedTemplates({ // Customize HTML minifier options minifyHTMLOptions: { removeAttributeQuotes: true, }, // Disable CSS minification css: false, }), ], output: { file: 'dist/bundle.js', format: 'es', }, });
Debug
Known issues
gotchaMust be placed after TypeScript or esbuild plugin in the Rollup plugin array to avoid corrupting template expressions.
fix
Ensure fastTaggedTemplates() comes after @rollup/plugin-typescript or rollup-plugin-esbuild.
affects: >=0.0.0
gotchaDo not use rollup-plugin-esbuild with minify: true; template expressions may be mangled. Use the separate minify plugin instead.
fix
Set esbuild's minify option to false and use @rollup/plugin-terser for final minification.
affects: >=0.0.0
gotchaComments inside tagged templates are preserved only if they contain expressions (e.g., ${/* comment */''}). Otherwise, they are removed.
fix
To keep a comment, wrap it in an expression: ${/* comment */''}
affects: >=0.0.0
gotchaThe package is ESM-only. It cannot be required() in a CommonJS context.
fix
Use import syntax; if your project is CJS, consider dynamic import().
affects: >=1.0.0
Errors
Common errors & fixes
Error: 'fastTaggedTemplates' is not exported by node_modules/rollup-plugin-fast-tagged-templates
Used named import { fastTaggedTemplates } instead of default import.
fix
Change to: import fastTaggedTemplates from 'rollup-plugin-fast-tagged-templates'
ERR_REQUIRE_ESM: require() of ES Module not supported
Attempting to require the package which is ESM-only.
fix
Use dynamic import: const fastTaggedTemplates = await import('rollup-plugin-fast-tagged-templates') or switch to ES modules.
TypeError: html is not a function
Using html tagged template from FAST but the plugin transformed it incorrectly (e.g., placed before TypeScript plugin).
fix
Ensure fastTaggedTemplates() is listed after @rollup/plugin-typescript or rollup-plugin-esbuild in the plugins array.
Upgrade
Version history
1.0.3latest on npm
Audit
Dependencies
html-minifier-terserrequiredUsed to minify HTML tagged templates. The plugin provides default options but you can override with minifyHTMLOptions.
rolluprequiredPeer dependency; this is a Rollup plugin.
Agent activity
4 hits · last 30 days
node
4
Resources
rollup-plugin-fast-tagged-templates — npm install rollup-plugin-fast-tagged-templates · libregistry