Co-Author: https://github.com/akurn
Special Thanks: https://github.com/DeveloperAlan
Forked from https://github.com/PixelTom/phaser-es6-boilerplate
You can play it here! https://pixeltom.itch.io/dungeon-trader
You will need to first install Node.js and the grunt-cli: npm install -g grunt-cli
.
- clone the repo
npm install
grunt
to run the dev build
All of the files required to run the game will live in the src
folder, this will include any JavaScript, images, HTML (Jade), and CSS (Stylus). When the default grunt task is invoked, these files are compiled to a build
directory.
Files in the build
directory will always be generated and excluded from Git by the .gitignore
, as such these will removed without warning and should generally not be edited.
- Use relative file paths for any assets loaded by your HTML or JavaScript. This will negate any potential path issues when the game is later uploaded to a webserver.
- If you intend to store development assets (i.e PSD's, Texture Packer files, etc) inside your project, store them outside of the
src
directory to avoid bloating your builds with them. - Browserify is crazy powerful. I'm not going to quote Spider-man, but you should definitely check out Substack's Browserify Handbook.
- Linting is disabled by default, if you'd like to enforce it for production builds update the
.jshintrc
with rules for your coding style and remove the comment block from jshint directive in the gruntfile's build task.
Configures and runs an unminified development build optimised for fast watch performance with source maps and live reload.
Creates an uglified, production ready build with no source maps.
Lossy compression of all png's in the src/images/
directory using pngquant.
(Linux users will need to have a version of pngquant available on their paths.)
Compiles the current build into {title}.zip
with an internal folder. This is intended for use when transferring the build to a third party for webserver upload.
Compiles the current build into {title}.zip
ready for upload to CocoonJs.
You might notice that Phaser isn't actually bundled in with the rest of our Browserify bundle. Bundling it was our first choice initially, however leaving it out enables use of the P2 Physics engine and makes grunt:browserify
run a whole lot faster. It also gives you the option to pull Phaser from in a CDN.
When adding new libraries that aren't CommonJS compatible, you'll have to update the Browserify Shim configuration.