Skip to content

Commit

Permalink
fix(v0.1.2): missing documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mario-aleo committed Feb 28, 2019
1 parent 9485f99 commit f9b2d8a
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 3 deletions.
70 changes: 68 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,68 @@
# rollup-plugin-html-scaffold
Html template plugin for Rollup
# rollup-plugin-html-scaffold
Generate HTML file based on a template file


## Installation
```yarn add --dev rollup-plugin-html-scaffold```
or
```npm install -D rollup-plugin-html-scaffold```


## Options
* input (Required): input html file
* output (Optional): output html file (default: input html file)
* template (Optional): key-value of placeholders that will be used to parse the html file


## Usage
index.html
```
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
<title><%= appName %></title>
<style>
body {
position: relative;
min-height: 100vh;
padding: 0;
margin: 0;
}
</style>
</head>
<body>
<script type="module" src="<%= es6Bundle %>"></script>
<%= someCoolScript %>
</body>
</html>
```

rollup.config.js
```
import html from 'rollup-plugin-html-scaffold';
export default {
input: ['src/index.js'],
output: {
file: 'dist/bundle.js',
format: 'es',
sourcemap: true,
},
plugins: [
html({
input: 'src/index.html',
output: 'index.html',
template: {
'appName': 'my-app',
'es6Bundle': 'bundle.js',
'someCoolScript': '<script>console.log('Too cool to live')</script>'
}
})
]
}
```
Your html file will be parsed and created in the output directory, without any additional code.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rollup-plugin-html-scaffold",
"version": "0.1.1",
"version": "0.1.2",
"description": "HTML template for Rollup",
"keywords": [
"rollup",
Expand Down

0 comments on commit f9b2d8a

Please sign in to comment.