Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aminnairi/rollup-plugin-create-html
Create HTML files when bundling your Rollup assets
https://github.com/aminnairi/rollup-plugin-create-html
create html plugin rollup
Last synced: about 5 hours ago
JSON representation
Create HTML files when bundling your Rollup assets
- Host: GitHub
- URL: https://github.com/aminnairi/rollup-plugin-create-html
- Owner: aminnairi
- License: gpl-3.0
- Created: 2022-04-15T00:44:57.000Z (over 2 years ago)
- Default Branch: development
- Last Pushed: 2022-04-15T01:15:23.000Z (over 2 years ago)
- Last Synced: 2024-05-27T22:05:12.600Z (6 months ago)
- Topics: create, html, plugin, rollup
- Language: JavaScript
- Homepage: https://npmjs.com/@aminnairi/rollup-plugin-create-html
- Size: 25.4 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @aminnairi/rollup-plugin-create-html
## Requirements
- Node
- NPM## Installation
```bash
npm install @aminnairi/rollup-plugin-create-html
```## Usage
```javascript
import { createHtml } from "./sources/rollup-plugin-create-html";export default {
input: "sources/index.js",
plugins: [
createHtml({
name: "index.html",
path: ".",
doctype: "",
root: {
name: "html",
attributes: {
lang: "en-US"
},
children: [
{
name: "head",
children: [
{ name: "meta", attributes: { charset: "UTF-8" } },
{ name: "meta", attributes: { name: "description", content: "description" } },
{ name: "meta", attributes: { name: "viewport", content: "width=device-width, initial-scale=1.0" } },
{ name: "title", children: ["title"] }
]
},
{
name: "body",
children: [
{ name: "div", attributes: { id: "root" }, children: [] },
{ name: "script", attributes: { src: "index.js", async: true, defer: true }, children: [] }
]
}
]
}
})
],
output: {
file: "build/index.js",
format: "iife"
}
}
``````html
title
```
## Options
### Name
The name of the file to generate. This should not include any folder.
```javascript
import { createHtml } from "@aminnairi/rollup-plugin-create-html";createHtml({
name: "index.html"
});createHtml({
name: "404.html"
});createHtml({
name: "200.html"
});
```### Path
The path to the file to generate. This should not include any file name nor absolute nor relative paths.
```javascript
import { createHtml } from "@aminnairi/rollup-plugin-create-html";createHtml({
path: "."
});createHtml({
path: "pages"
});createHtml({
name: "assets/html"
});
```### Doctype
The doctype for the generated file.
```javascript
import { createHtml } from "@aminnairi/rollup-plugin-create-html";createHtml({
doctype: ""
});createHtml({
doctype: ``
});
```### Root
The HTML content of the document to generate.
```javascript
import { createHtml } from "@aminnairi/rollup-plugin-create-html";createHtml({
name: "index.html",
path: ".",
doctype: "",
root: {
name: "html"
}
});
``````html
```
```javascript
createHtml({
name: "index.html",
path: ".",
doctype: "",
//
root: {
name: "html",
children: []
}
});
``````html
```
```javascript
createHtml({
name: "index.html",
path: ".",
doctype: "",
//
root: {
name: "html",
attributes: {
lang: "en-US",
dir: "ltr"
},
children: []
}
});
``````html
```
```javascript
createHtml({
name: "index.html",
path: ".",
doctype: "",
// HTML
root: {
name: "html",
children: [
"HTML"
]
}
});
``````html
HTML
```
```javascript
createHtml({
name: "index.html",
path: ".",
doctype: "",
//
root: {
name: "html",
children: [
{
name: "body",
children: [
{
name: "div",
attributes: {
id: "root"
},
children: []
}
{
name: "script",
attributes: {
src: "index.js",
async: true,
defer: false
},
children: []
}
]
}
]
}
});
``````html
```