Skip to content

Instantly share code, notes, and snippets.

@cvan
Last active May 26, 2017 15:08
Show Gist options
  • Save cvan/2cbe499be3b433cf931d02a3a50cddaa to your computer and use it in GitHub Desktop.
Save cvan/2cbe499be3b433cf931d02a3a50cddaa to your computer and use it in GitHub Desktop.
useful commands for `aframe` CLI (WIP)

Install the aframe CLI:

npm install -g aframe-cli

Run the aframe CLI:

aframe

See the usage information for the aframe CLI:

aframe --help

Create a new A-Frame site:

# Start from a default "Hello, World" template.
aframe new my-new-aframe-directory

# Start from a "360° Image Gallery" template (which uses third-party components).
aframe new my-new-aframe-directory --template 360-image-gallery

Set up your A-Frame site:

cd my-new-aframe-directory
aframe serve  # The URL to the server (default: http://localhost:3333) is copied to your clipboard even!

And, if you want to set your site up for deploying to production (GitHub Pages):

export MY_TEMPLATE_NAME="my-new-aframe-directory"
cd $MY_TEMPLATE_NAME
git init
git remote add origin git@github.com:aframevr-userland/$MY_TEMPLATE_NAME.git
npm install
npm start
npm run deploy  # Deploys to GitHub Pages.

Do note that these steps above will be improved greatly (with the git configuration, etc.). Soon, I'll get it working to work just like this:

cd my-new-aframe-directory
aframe serve
aframe serve --production  # To test how the minified CSS/JS + Service Worker work in a production environment.
aframe deploy  # Builds the assets locally and deploys to GitHub Pages.

You won't need to have any knowledge of npm or any of that. Just basic CLI commands:

npm install -g aframe-cli

aframe new cvans-worlds && cd cvans-worlds

aframe serve
aframe deploy  # The URL to your site is copied to clipboard, ready to share with the world.

And then you have your very own A-Frame site online!

# And more deployment targets coming soon.
aframe deploy --feed
aframe deploy --ipfs
aframe deploy --now
aframe deploy --itch

And could even offer built-in sharing (e.g., tweeting) from the command line:

aframe tweet -m 'check out my new #WebVR worlds. (Made with A-Frame @aframevr, a #WebVR framework.)'

The end!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment