Registry / web-framework / rollup-plugin-template

rollup-plugin-template

JSON →
library1.0.10jsnpmunverified

A Rollup plugin that allows importing HTML files as template strings. Version 1.0.10 is the latest stable release; the package has not seen updates since 2018. It differentiates from other HTML handling plugins by focusing purely on importing raw HTML content without transformation, for use in templating engines or string manipulation. Suitable for projects that need to embed HTML templates directly into JavaScript bundles. No active maintenance or known issues.

npm install rollup-plugin-template
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-TEMP
R
rollup-plugin-template
web-frameworkjavascriptv1.0.10
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

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

default
import template from 'rollup-plugin-template'
import { template } from 'rollup-plugin-template'
The package exports a single function as default import.
template
import template from 'rollup-plugin-template'
const template = require('rollup-plugin-template')
ESM import is required; require() is not supported.
template(options)
template({ include: '*.html' })
template({ include: ['*.html'] })
The include option expects a single glob string, not an array.

Configures Rollup to import HTML files as template strings using the glob pattern 'src/templates/**/*.html'.

// rollup.config.js import template from 'rollup-plugin-template'; export default { input: 'src/index.js', output: { file: 'dist/bundle.js', format: 'iife' }, plugins: [ template({ include: 'src/templates/**/*.html' }) ] };
Debug
Known issues
gotchaThe plugin does not transform HTML in any way; it simply returns the file content as a string. If you need minification or partial injection, use other plugins.
fix
Ensure your HTML files are minified before import or use an additional plugin like rollup-plugin-html-minifier.
affects: >=0.0.0
deprecatedThe 'include' option is a single string glob, not an array. Passing an array will cause the plugin to fail silently.
fix
Use a single string glob for include; for multiple patterns, use a brace expansion or combine with rollup's plugin array.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'rollup-plugin-template'
The package is not installed or not listed in devDependencies.
fix
Run 'npm install --save-dev rollup-plugin-template' to install it.
TypeError: template is not a function
Using named import instead of default import.
fix
Change import to: import template from 'rollup-plugin-template'
(!) Plugin template: TypeError: options.include is not a string
Passing an array to the include option.
fix
Change include option to a single glob string, e.g., 'src/templates/*.html'
Upgrade
Version history
1.0.10latest on npm
Audit
Dependencies
rolluprequiredpeer dependency required to work as a Rollup plugin
Agent activity
10 hits · last 30 days
node
8
Resources
rollup-plugin-template — npm install rollup-plugin-template · libregistry