https://github.com/uppercod/rollup-plugin-input-html
This plugins allows the export of relative mjs modules from .HTML files, similar to the work of parceljs, but using ESM modules.
https://github.com/uppercod/rollup-plugin-input-html
html rollup rollup-plugin
Last synced: about 1 year ago
JSON representation
This plugins allows the export of relative mjs modules from .HTML files, similar to the work of parceljs, but using ESM modules.
- Host: GitHub
- URL: https://github.com/uppercod/rollup-plugin-input-html
- Owner: UpperCod
- Created: 2019-05-28T05:47:45.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-03T11:24:10.000Z (over 3 years ago)
- Last Synced: 2024-12-23T22:26:56.645Z (over 1 year ago)
- Topics: html, rollup, rollup-plugin
- Language: JavaScript
- Homepage:
- Size: 31.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# rollup-plugin-input-html
This plugins allows the export of relative mjs modules from .HTML files, similar to the work of parceljs, but using ESM modules.
## Example:
### input: index.html
```html
Document
```
### output: index.html
```html
Document
```
script, `src="./index.js"` has the group of `src="./app-1.js"` and `src="./app-2.js"`.
```js
import inputHTML from "@atomico/rollup-plugin-input-html";
export default {
input: "index.html", //or can use fast-glob expressions, example: *.html, ui-*.html
output: {
dir: "./dist",
format: "esm",
sourcemap: true
},
plugins: [inputHTML() /** ,...otherPlugins **/]
};
```
## default configuration
```js
let defaultOptions = {
include: ["**/*.html"],
exclude: [],
createHTML: true // allows the creation of the html file based on the origin
};
```
#### This plugins must be included as the first element, in order to transfer the modules to the bundle.
### Multiple inputs
You can also use multiple entries supported by rollup, this generate chuck, which group the code between 1 or more html files.
## ⚠️ RULE
do not import html nested in folders outside of root or inside root, since for now this plugins will resolve the path but the rollup import generates a non-deep bundle in directory. **logical is a bundle**.
## This plugins uses the power of
[fast-glob](https://github.com/mrmlnc/fast-glob): small utility for the recovery of files based on search expressions.
[rollup-pluginutils]: allows to generate include and exclude plugins format.