j0hnskot Posted August 4, 2014 Share Posted August 4, 2014 Hello there! My source code starts to get a little messy and i decided to use browserify. I'm having some trouble to understand how i can achieve that.Is there a tutorial on how to setup a project with the proper structure? Also, does someone got a template i can take a look on to understand how it works? Link to comment Share on other sites More sharing options...
eguneys Posted August 4, 2014 Share Posted August 4, 2014 Why not use RequireJS? I have an example repo that demonstrates a phaser skeleton using RequireJS. https://github.com/eguneys/phaser_states. Link to comment Share on other sites More sharing options...
j0hnskot Posted August 4, 2014 Author Share Posted August 4, 2014 Actually the first problem i have is that i got no idea how to add phaser via require. I guess both requirejs and browserify need some kind of "trick" to inlcude phaser. I really can't understand what to do. Link to comment Share on other sites More sharing options...
jschomay Posted August 5, 2014 Share Posted August 5, 2014 Hi, after trying out a number of build tools, my favourite is brunch. It uses commonJS style modules (like browserify), and offers many other build/automation options, like file watching, code compiling (coffeescript, sass, etc), running tests, browser live reload, etc.) It is also faster than grunt and browswerify I think. In a nutshell, you put your vendor files (like phaser) in /vendor, your static assets in app/assets, and your source code in app/. It all gets built to public/. You can also use bower instead of vendor/ if you like. Here is one of my current games in progress using brunch: https://github.com/jschomay/color-blocks-blitz. Note the directory structure, and in particular, the package.json and brunch-config.coffee files. You'll need node/npm installed to get brunch, see the website for details. Good luck, hope that helps. Link to comment Share on other sites More sharing options...
Heppell08 Posted August 5, 2014 Share Posted August 5, 2014 I personally use this: https://github.com/codevinsky/generator-phaser-official Codevinsky set it up and it works perfectly. Link to comment Share on other sites More sharing options...
j0hnskot Posted August 6, 2014 Author Share Posted August 6, 2014 Thank you all ! I used the yeoman generator to understand how browserify works . Link to comment Share on other sites More sharing options...
Recommended Posts