Go to file
Paul Graffam e8177659ac Added minimization, set up css extract plugin, added style chunking, fixed paths 2019-01-29 16:56:13 -05:00
build Re-built 2019-01-29 16:54:53 -05:00
src Added template logic 2019-01-29 16:55:18 -05:00
.babelrc Set to correct new babel preset 2019-01-23 17:24:08 -05:00
.eslintrc Updated eslint rules, set to warning to continue npm execution 2016-10-06 23:17:10 -04:00
.gitignore Initial commit 2016-09-12 15:54:07 -04:00
LICENSE Adding license 2018-01-28 20:54:09 -05:00
README.md Add url to readme.md 2018-06-27 09:46:49 +07:00
package-lock.json Added new packages, updated scripts 2019-01-29 16:52:45 -05:00
package.json Added new packages, updated scripts 2019-01-29 16:52:45 -05:00
postcss.config.js Added postcss autoprefixing 2019-01-29 16:55:27 -05:00
webpack.config.js Added minimization, set up css extract plugin, added style chunking, fixed paths 2019-01-29 16:56:13 -05:00

README.md

Three.js Webpack ES6 Boilerplate

https://github.com/paulmg/ThreeJS-Webpack-ES6-Boilerplate/

A basic boilerplate for a Three.js project including the use of Webpack and ES6 syntax via Babel.

Project Structure

build - Directory for built and compressed files from the npm build script
src - Directory for all dev files
├── css - Contains all SCSS files, that are compiled to `src/public/assets/css`
├── js - All the Three.js app files, with `app.js` as entry point. Compiled to `src/public/assets/js` with webpack
│   ├── app
│   │   ├── components - Three.js components that get initialized in `main.js`
│   │   ├── helpers - Classes that provide ideas on how to set up and work with defaults
│   │   ├── managers - Manage complex tasks such as GUI or input
│   │   └── model - Classes that set up the model object
│   ├── data - Any data to be imported into app
│   └── utils - Various helpers and vendor classes
└── public - Used by webpack-dev-server to serve content and is copied over to build folder with build command. Place external vendor files here.

Getting started

Install dependencies:

npm install

Then run dev script:

npm run dev

Spins up a webpack dev server at localhost:8080 and keeps track of all js and sass changes to files. Only reloads automatically upon save of js files.

Build

npm run build

Cleans existing build folder while linting js folder and then copies over the public folder from src. Then sets environment to production and compiles js and css into build.

Other NPM Scripts

You can run any of these individually if you'd like with the npm run command:

  • prebuild - Cleans build folder and lints src/js
  • clean - Cleans build folder
  • lint - Runs lint on src/js folder and uses .eslintrc file in root as linting rules
  • webpack-server - Create webpack-dev-server with hot-module-replacement
  • webpack-watch - Run webpack in dev environment with watch
  • dev:sass - Run node-sass on src/css folder and output to src/public and watch for changes
  • dev:js - Run webpack in dev environment without watch
  • build:dir - Copy files and folders from src/public to build
  • build:sass - Run node-sass on src/css and output compressed css to build folder
  • build:js - Run webpack in production environment

Input Controls

  • Press H to hide dat.GUI
  • Arrow controls will pan
  • Mouse left click will rotate/right click will pan
  • Scrollwheel zooms in and out