Skip to content

Commit d784d38

Browse files
committed
Add rollup-plugin-serve for the examples
1 parent 5458342 commit d784d38

5 files changed

Lines changed: 56 additions & 8 deletions

File tree

examples/counter.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414
<body>
1515
<div id="app" />
16+
<br />
17+
<br />
18+
<a href="index.html">&nbsp;Back to index</a>
1619

1720
<script>
1821
const h = hyperapp.h

examples/index.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<meta charset="utf-8" />
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<title>Devtools Examples</title>
8+
<meta name="viewport" content="width=device-width, initial-scale=1">
9+
</head>
10+
11+
<body>
12+
<h1>Devtools examples</h1>
13+
<a href="./counter.html">Counter</a>
14+
</body>
15+
16+
</html>

package-lock.json

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22
"name": "hyperapp-devtools",
33
"version": "0.1.1",
44
"description": "Developer tools for Hyperapp projects",
5-
"keywords": [
6-
"hyperapp",
7-
"devtools",
8-
"debug"
9-
],
5+
"keywords": ["hyperapp", "devtools", "debug"],
106
"author": "Anthony Ferrando <ferrando.tony@gmail.com>",
117
"license": "MIT",
128
"main": "dist/hyperapp-devtools.js",
@@ -16,8 +12,9 @@
1612
"typings": "dist/src/index.d.ts",
1713
"scripts": {
1814
"clean": "rimraf dist .rpt2_cache",
19-
"start": "rollup -c -w | cpx dist/hyperapp-devtools.js examples -w",
20-
"build": "npm run clean && npm run build:module && npm run build:main && npm run build:min && cpx dist/hyperapp-devtools.js examples",
15+
"start": "rollup -c -w --serve | cpx dist/hyperapp-devtools.js examples -w",
16+
"build":
17+
"npm run clean && npm run build:module && npm run build:main && npm run build:min && cpx dist/hyperapp-devtools.js examples",
2118
"build:main": "rollup -c && rimraf .rpt2_cache",
2219
"build:min": "rollup -c --min && rimraf .rpt2_cache",
2320
"build:module": "rollup -c --es && rimraf .rpt2_cache"
@@ -35,6 +32,7 @@
3532
"rollup-plugin-commonjs": "8.2.6",
3633
"rollup-plugin-node-resolve": "3.0.0",
3734
"rollup-plugin-postcss": "^1.4.0",
35+
"rollup-plugin-serve": "^0.4.2",
3836
"rollup-plugin-typescript2": "0.8.0",
3937
"rollup-plugin-uglify": "2.0.1",
4038
"typescript": "^2.7.2"

rollup.config.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ const nodeResolve = require("rollup-plugin-node-resolve")
55
const typescript = require("rollup-plugin-typescript2")
66
const uglify = require("rollup-plugin-uglify")
77
const postcss = require("rollup-plugin-postcss")
8+
const serve = require("rollup-plugin-serve")
89

910
const options = minimist(process.argv.slice(2), {
10-
boolean: ["min", "es"]
11+
boolean: ["min", "es", "serve"]
1112
})
1213

1314
const plugins = [
@@ -27,6 +28,14 @@ const plugins = [
2728
if (options.min) {
2829
plugins.push(uglify())
2930
}
31+
if (options.serve) {
32+
plugins.push(
33+
serve({
34+
open: true,
35+
contentBase: "examples"
36+
})
37+
)
38+
}
3039

3140
export default {
3241
input: "src/index.ts",

0 commit comments

Comments
 (0)