Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bdadam/rollup-plugin-html
Import HTML files as strings in rollup build
https://github.com/bdadam/rollup-plugin-html
html-files minification npm-package rollup rollup-plugin
Last synced: 25 days ago
JSON representation
Import HTML files as strings in rollup build
- Host: GitHub
- URL: https://github.com/bdadam/rollup-plugin-html
- Owner: bdadam
- License: mit
- Created: 2016-08-28T10:18:45.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-12-10T07:07:17.000Z (about 6 years ago)
- Last Synced: 2024-10-29T21:48:39.009Z (about 1 month ago)
- Topics: html-files, minification, npm-package, rollup, rollup-plugin
- Language: JavaScript
- Homepage:
- Size: 11.7 KB
- Stars: 37
- Watchers: 3
- Forks: 10
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - html - Import html files as strings. (Plugins / Other File Imports)
README
# rollup-plugin-html [![Build Status](https://travis-ci.org/bdadam/rollup-plugin-html.svg)](https://travis-ci.org/bdadam/rollup-plugin-html)
Rollup plugin for loading content of HTML files to use as string variable in JavaScript code.
## Installation
```bash
npm install --save-dev rollup-plugin-html
```## Usage
```js
import { rollup } from 'rollup';
import html from 'rollup-plugin-html';rollup({
entry: 'main.js',
plugins: [
html({
include: '**/*.html'
})
]
}).then(...)
```## Options
### include
Type: `array` or `string`
Default: `**/*.html`A single file pattern, or an array of file patterns to include when importing html files. For more details see [rollup-pluginutils](https://github.com/rollup/rollup-pluginutils#createfilter).
### exclude
Type: `array` or `string`
Default: `undefined`A single file pattern, or an array of file patterns to exclude when importing html files. For more details see [rollup-pluginutils](https://github.com/rollup/rollup-pluginutils#createfilter).
### htmlMinifierOptions
Type: `Object`
Default: `{}`The options which are given to [html-minifier](https://github.com/kangax/html-minifier#options-quick-reference)
E.g.:
```JavaScript
rollup({
entry: 'main.js',
plugins: [
html({
include: '**/*.html',
htmlMinifierOptions: {
collapseWhitespace: true,
collapseBooleanAttributes: true,
conservativeCollapse: true,
minifyJS: true
}
})
]
}).then(...)
```## License
MIT
## Credits
Thanks for Bogdan Chadkin (@TrySound) for his [rollup-plugin-string](https://github.com/TrySound/rollup-plugin-string) rollup plugin which I used as the basis for this plugin.