ES6 Boilerplate.
Built with A-Frame.
This is just my personal AFrame starter template with some basic build steps included.
npm install
npm run start
While you're actively working on code, you may want to run the watch
command.
This will continuously rebuild your bundle for you as you make changes. Note
that this must be run in addition to, not instead of, run
.
Put your JS source files into the src
directory however you would like, just
make sure to include them in the top-level index.js
file. You can include
your files using either import
or require
syntax:
import "./src/my-component.js"
require("./src/my-component.js");
When you want to bundle your included JS files into build/bundle.js
just call
npm run build
from the command line. If you'd prefer a minified version, call
npm run release
. This will create the file build/bundle.min.js
. If you want
to use the minified version in your scene, be sure to update the script
reference in index.html
.
The package.json
file is locking the A-Frame version to 0.8.2, which is the
latest stable release as of this writing. To update to a different stable
version, just update the pin. You'll need to rebuild afterwards to make sure
that the bundled javascript has the latest. If you'd prefer to work from
master
instead, just replace this line:
"aframe": "^0.8.2"
With this one:
"aframe": "github:aframevr/aframe#master"