Jump to content

Removing PHP pages from Phaser repository


ooflorent
 Share

Recommended Posts

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

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

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

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-examples

There 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

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

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

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.org

2) clone phaser wherever you want

3) 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

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

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...