ooflorent Posted September 24, 2013 Share Posted September 24, 2013 Since grunt and npm are used to build phaser, why is there still PHP pages? They could easilly be replaced by a node.js frontend!This could be done without requiring the user to install an *AMP stack (*, Apache, MySQL, PHP). If rich and others like the idea, I could make a PR.What do you think about it? Link to comment Share on other sites More sharing options...
rich Posted September 24, 2013 Share Posted September 24, 2013 The simple answer is because grunt isn't actually used to build Phaser at all yet. It's also mostly used in the examples, not the build, where it provides for the dynamic content listing / header / footer actions. It will be removed at some point, but it's not as simple as just doing a JS build. Link to comment Share on other sites More sharing options...
ooflorent Posted September 24, 2013 Author Share Posted September 24, 2013 If you are OK I can make a PR that will be merged later. Link to comment Share on other sites More sharing options...
rich Posted September 24, 2013 Share Posted September 24, 2013 Will it solve the issue of all the examples not then running? Link to comment Share on other sites More sharing options...
ooflorent Posted September 24, 2013 Author Share Posted September 24, 2013 I don't understand what issue you are talking about, sorry.Do you mean: "Will you fix broken examples?" Link to comment Share on other sites More sharing options...
rich Posted September 24, 2013 Share Posted September 24, 2013 It's also mostly used in the examples, not the build, where it provides for the dynamic content listing / header / footer actions. It will be removed at some point, but it's not as simple as just doing a JS build. ^ This part. Even if you make a grunt task to build phaser you'll still need php at the moment to run any example. Also if you DO make a grunt task to build it, you absolutely have to cat the JS files in the exact same order as in the js.php file or it will all horribly die Link to comment Share on other sites More sharing options...
ooflorent Posted September 24, 2013 Author Share Posted September 24, 2013 Oh no, I didn't clearly explained what I meant. I'll would port all PHP pages to a node.js frontend and add a grunt command such as run-examples that will start a local node.js server. Dependencies would be pulled using npm. This way, just after checking out phaser's repo, the user can run the following commands:$ npm install$ grunt run-examplesThere is no additional requirements. The user does not need anymore to install/configure Apache, PHP to try phaser's examples. Also if you DO make a grunt task to build it, you absolutely have to cat the JS files in the exact same order as in the js.php file or it will all horribly die I'm sure I could find a trick to do that! Link to comment Share on other sites More sharing options...
rich Posted September 24, 2013 Share Posted September 24, 2013 Ok that makes a lot more sense, and ultimately I would like something like this, but think about it from a newcomers point of view: 1) Install WAMP. Unzip folder to web root. Or 2) Install node.js. Install grunt. npm install. grunt run-examples. I like the thought of removing php from the equation a lot, but enforcing node and grunt actually makes the getting started process more complex, not less complex. However it would be very sensible to support it for those who already use node/grunt. In those cases it would be extremely useful for sure. Link to comment Share on other sites More sharing options...
ooflorent Posted September 24, 2013 Author Share Posted September 24, 2013 What about static compiling?The grunt task generates a static site which can be deployed on every server. Link to comment Share on other sites More sharing options...
rich Posted September 24, 2013 Share Posted September 24, 2013 Yes I think a static version of the examples folder would be extremely useful. It's sort of a benefit and a downside too, because I love the fact that right now I can just open the template.php, put a new test in, save it and it appears on my examples list and works immediately (no having to rebuild a static site via a grunt task). It feels like there are 2 things here: grunt tasks to aid in the deployment of the Phaser library itself (so building docs, compiling source, static examples) and a different set of tasks to aid in actual game development and testing (livereload, http server, etc). Link to comment Share on other sites More sharing options...
Mike Posted September 24, 2013 Share Posted September 24, 2013 Although I like node.js very much the approach: 1) Install WAMP. Unzip folder to web root. Is far more easy and I personally like it more. also almost every developer has apache, php server or hosting. Link to comment Share on other sites More sharing options...
ooflorent Posted September 25, 2013 Author Share Posted September 25, 2013 The PR is done: https://github.com/photonstorm/phaser/pull/67 Examples are generated using assemble.io.Phaser is now built using grunt. Link to comment Share on other sites More sharing options...
ironicnet Posted September 25, 2013 Share Posted September 25, 2013 I was working in the same thing, putting nodejs for running the examples... I think that i'm just gonna use your fork Link to comment Share on other sites More sharing options...
ooflorent Posted September 25, 2013 Author Share Posted September 25, 2013 You could also wait a few days until rich merges the PR! Link to comment Share on other sites More sharing options...
xerver Posted September 25, 2013 Share Posted September 25, 2013 As someone who does both PHP and Node.js development, I garuntee that "Install WAMP" is more work than all of setup two, which although you made it sound hard by speaking out each step, it really isn't: 1) Install node.js from http://nodejs.org2) clone phaser wherever you want3) npm -i grunt-cli && npm i && grunt serve Done. The only different is that (eventually) you need grunt/nodejs to build, generate docs, jshint, and other tasks too so likely you will already have grunt/nodejs installs so really it is just: `grunt serve`. Setting up Apache, and PHP even via WAMP has way more complications than just using NPM to install what you need. +9001 for using grunt for everything. I would be more than happy to convert it all for you Rich if you are looking for help, all my projects use grunt for everything and it is nearly trival to get setup. Link to comment Share on other sites More sharing options...
ooflorent Posted September 25, 2013 Author Share Posted September 25, 2013 The debate is no longer about using NodeJS to serve examples. With my PR, examples are compiled to static HTML files.The output directory could be distributed as a standard ZIP archive which can be decompressed any web server. Moreover, I've updated my PR. Now everything should be OK.IMHO, directory structure must be changed but that's another debate! Link to comment Share on other sites More sharing options...
Recommended Posts