This commit is contained in:
parent
7f991b2b09
commit
141c48730a
44
README.md
44
README.md
@ -10,20 +10,23 @@
|
|||||||
[](https://liberamanifesto.com)
|
[](https://liberamanifesto.com)
|
||||||
|
|
||||||
# rollup-plugin-html-entry2
|
# rollup-plugin-html-entry2
|
||||||
| :warning: WARNING |
|
|
||||||
|:----------------------------------------------------------------------------------------------------------------------|
|
|
||||||
| **Experimental-stage** plugin. Expect bugs and missing features... |
|
|
||||||
| :warning: WARNING |
|
|
||||||
| :------------------------------------------------------------------- |
|
|
||||||
| **Renaming** Name might change in the future. Consider rollup-plugin-html-bundler |
|
|
||||||
| (because we're basically transforming rollup into a tool for bundling html, might not even contain any JS in the end) |
|
|
||||||
|
|
||||||
A(nother) rollup plugin that tries to teach Rollup to start from an HTML entry, and the use of (multiple) HTML files in general.
|
> ⚠️ WARNING: **Experimental-stage** plugin ⚠️
|
||||||
|
> ---
|
||||||
|
> Expect bugs and missing features...
|
||||||
|
|
||||||
|
> ⚠️ **Renaming** ⚠️\
|
||||||
|
> Name might change in the future. Considering rollup-plugin-html-bundler
|
||||||
|
̇> (because we're basically transforming rollup into a tool for bundling html, might not even contain any JS in the end)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
A(nother) [rollup](https://rollupjs.org) plugin that tries to teach Rollup to start from an HTML entry, and the use of (multiple) HTML files in general.
|
||||||
The goal is to include assets referenced by the HTML file into the build-process as to copy/inline where appropriate and
|
The goal is to include assets referenced by the HTML file into the build-process as to copy/inline where appropriate and
|
||||||
optionally optimize them. Without having to seperatly copy them to the output directory.
|
optionally optimize them. Without having to seperatly copy them to the output directory.
|
||||||
|
|
||||||
When building web-applications a HTML-file is simply the logical entry point into your application. \
|
When building web-applications a HTML-file is simply the logical entry point into your application. \
|
||||||
Inspired (and forked) by the original [@rollup/plugin-html](https://www.npmjs.com/package/@rollup/plugin-html),
|
Inspired by (and forked from) the original [@rollup/plugin-html](https://www.npmjs.com/package/@rollup/plugin-html),
|
||||||
this plugin will also allow you to transform the source files by any HTML-templating engine such as [handlebars].
|
this plugin will also allow you to transform the source files by any HTML-templating engine such as [handlebars].
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +34,7 @@ Please see [Supported Output Formats](#supported-output-formats) for information
|
|||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
This plugin requires an [LTS](https://github.com/nodejs/Release) Node version (v18.0.0+) and Rollup v3.?.?+.
|
This plugin aims to support active [LTS](https://github.com/nodejs/Release) versions Node versions v18, v20 + Rollup v3 and up
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
@ -59,7 +62,7 @@ export default {
|
|||||||
|
|
||||||
!! To use 'import x from y' syntax you might need to set `"type": "module"` in your `package.json`.
|
!! To use 'import x from y' syntax you might need to set `"type": "module"` in your `package.json`.
|
||||||
[Javascript modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) are the _preferred_ way of writing modern Javascript.
|
[Javascript modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) are the _preferred_ way of writing modern Javascript.
|
||||||
Due to the early stage development of this plugin, old-style CommonJS modules are completely ignored for now.
|
Due to the early stage development of this plugin, old-style CommonJS modules are completely ignored and unsupported for now.
|
||||||
|
|
||||||
Then call `rollup` either via the [CLI](https://www.rollupjs.org/guide/en/#command-line-reference) or the [API](https://www.rollupjs.org/guide/en/#javascript-api).
|
Then call `rollup` either via the [CLI](https://www.rollupjs.org/guide/en/#command-line-reference) or the [API](https://www.rollupjs.org/guide/en/#javascript-api).
|
||||||
|
|
||||||
@ -83,6 +86,9 @@ async function build() {
|
|||||||
input: 'index.hbs',
|
input: 'index.hbs',
|
||||||
plugins: [
|
plugins: [
|
||||||
html({
|
html({
|
||||||
|
include: [
|
||||||
|
'**/*.(html|hbs)',// html or handlebars
|
||||||
|
],
|
||||||
transform(src) {
|
transform(src) {
|
||||||
return handlebars.compile(src)({a: 'a'})
|
return handlebars.compile(src)({a: 'a'})
|
||||||
}
|
}
|
||||||
@ -93,23 +99,29 @@ async function build() {
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Supported Output Formats
|
## Supported Output Formats
|
||||||
|
|
||||||
By default, this plugin supports the `esm` (`es`). Any other format is currently untested as this plugin is in an early state, see [#status](#status)
|
By default, this plugin supports the `esm` (`es`). Any other format is currently untested as this plugin is in an early state, see [#status](#status)
|
||||||
|
|
||||||
## Status
|
## Status
|
||||||
### (Rudimentarily) supported
|
### (Rudimentarily) supported
|
||||||
- Importing JS via `<script src="..." type="module">` tags
|
- Importing JS via `<script src="..." type="module">` tags
|
||||||
- Importing assets using @rollup/plugin-url (which could use an update TBH)
|
|
||||||
- Compatibility with other plugins such as @rollup/plugin-node-resolve, @rollup/plugin-babel, @rollup/plugin-commonjs, @rollup/plugin-terser and rollup-plugin-livereload
|
|
||||||
- Inline scripts (i.e `<script>...</script>`)
|
- Inline scripts (i.e `<script>...</script>`)
|
||||||
|
- Compatibility with other plugins such as :
|
||||||
|
- [@rollup/plugin-url](https://www.npmjs.com/package/@rollup/plugin-url) including using it for `<img src"..."/>` references
|
||||||
|
- [@rollup/plugin-node-resolve](https://www.npmjs.com/package/@rollup/plugin-node-resolve)
|
||||||
|
- [@rollup/plugin-babel](https://www.npmjs.com/package/@rollup/plugin-babel)
|
||||||
|
- [@rollup/plugin-commonjs](https://www.npmjs.com/package/@rollup/plugin-commonjs)
|
||||||
|
- [@rollup/plugin-typescript](https://www.npmjs.com/package/@rollup/plugin-typescript)
|
||||||
|
- [@rollup/plugin-terser](https://www.npmjs.com/package/@rollup/plugin-terser)
|
||||||
|
- [rollup-plugin-livereload](https://www.npmjs.com/package/rollup-plugin-livereload)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Not (yet/properly) supported
|
### Not (yet/properly) supported
|
||||||
- Sourcemaps (inlined script) (dev-note: we're already including magic-string for this, but do not use it yet, neeeds refactoring)
|
- Sourcemaps (inlined script) (dev-note: we're already including magic-string for this, but do not fully using it yet, neeeds refactoring)
|
||||||
- Plugins importing CSS files
|
- Plugins importing CSS files
|
||||||
- CommonJS (cjs) and IIFI output formats. (Is UMD actually ever used?)
|
- CommonJS (cjs) and IIFI output formats. (Is UMD actually ever used?)
|
||||||
- Overriding which DOM-nodes and resulting URLS to ignore/include (in a clean way)
|
- Overriding which DOM-nodes and resulting URLS to ignore/include (in a clean way)
|
||||||
- Other (various) plugins such as typescript, or those for HMR etc
|
- Other (various) plugins such as those for HMR etc
|
||||||
- ...
|
- ...
|
||||||
|
|
||||||
# Contibuting
|
# Contibuting
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user