Skip to content

Commit 8509c9d

Browse files
committed
Add autoreload and serve files directly from rollup
1 parent 9ffa670 commit 8509c9d

File tree

4 files changed

+1036
-24
lines changed

4 files changed

+1036
-24
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ If you want to contribute to this project, you will also need to install Python
142142
143143
Running `./server.sh` will start a basic Python webserver. Go to http://localhost:8001/examples/index.html to load a simple example.
144144
145-
If you're making changes to the code, run `yarn build` to update the build outputs. `yarn build:watch` will continuously watch for your changes and update the build.
145+
If you're making changes to the code, run `yarn build` to update the build outputs. `yarn build:watch` will continuously watch for your changes and update the build and also host a server on localhost:8001 (so you don't have to start the Python server separately).
146146
147147
# Usage
148148

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@
2121
"prettier": "^1.18.2",
2222
"rollup": "^0.67.4",
2323
"rollup-plugin-commonjs": "^9.2.0",
24+
"rollup-plugin-livereload": "^1.0.3",
2425
"rollup-plugin-node-resolve": "^4.0.0"
2526
},
2627
"dependencies": {
2728
"julian": "^0.2.0",
2829
"postprocessing": "^6.8.0",
30+
"rollup-plugin-serve": "^1.0.1",
2931
"three": "^0.107.0"
3032
}
3133
}

rollup.config.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import commonjs from 'rollup-plugin-commonjs';
2+
import livereload from 'rollup-plugin-livereload';
23
import resolve from 'rollup-plugin-node-resolve';
4+
import serve from 'rollup-plugin-serve';
35

46
export default {
57
input: 'src/spacekit.js',
@@ -10,5 +12,10 @@ export default {
1012
file: 'build/spacekit.js',
1113
},
1214
],
13-
plugins: [resolve(), commonjs()],
15+
plugins: [
16+
resolve(),
17+
commonjs(),
18+
livereload(),
19+
serve({ port: 8001, contentBase: ['.'] }),
20+
],
1421
};

0 commit comments

Comments
 (0)