With these small changes yeoman server can serve php files directly through php-cgi.
You can find a screencast and some background here: http://fgnass.github.com/2012/08/30/yeoman.html
Please let me know what you think about the idea.
support serving php files through php-cgi
updated the gateway dependency
Nice work! Some interesting refactoring going on there :)
Thanks, I'm glad you like it.
About your last concern: The only PHP-specific part ist the mapping from the file-extension to the name of the CGI interpreter. Everything else RFC 3875 which is completely language agnostic. A good idea would probably be to put these mappings into the Gruntfile so that developers can add their own.
About the size of the new dependencies: Both new modules tamper and gateway don't have any further external dependencies and consist of only one single file. The largest part of both modules are their unit tests ;)
BTW, the tamper test-suite checks if the server behaves in the same way with and without the middleware in place (even for large files). But I absolutely agree that we should thoroughly test that this doesn't break anything.
I applaud and appreciate the effort, but this is IMHO a bad idea.
If you intent is to be able to use yeoman server for its livereload ability, you should rely on the livereload extensions and avoid the need of any script injection. You can then use any kind of HTTP server, you'll just need to start yeoman server without using it as an HTTP server, just for the file watch and notification to livereload.js
To be able to establish the connection, you'll need to force the port to 35729 in the Gruntfile config, with server.port=35729.
I've tested it on a dummy wordpress install and now using it extensively at work on a symfony project.
I think the script injection is actually a pretty rad feature as it allows you to live-reload sites even in ancient browsers as well as on mobile devices (without having to use tools like Adobe Shadow). So this is super useful for cross-browser testing.
I like it. Nice work @fgnass
I think we'll wait a little bit and let the 1.0 ship, but I'd like to return to this feature soon.
I really would like php support in Yeoman, but can't make it work. I have installed php-cgi, but just don't get how to load the gateway module and initialize tamper. Can you please explain, or upload your example project? Thx
I have tried gateway and tamper. They can not work properly, following error occurred.
Can't set headers after they are sent.
@blueyestar That issue should have been fixed in email@example.com. If it still happens with the latest version, it would be nice if you could file a bug over at https://github.com/fgnass/gateway/issues
Just a heads up.
I landed this middleware option in grunt-contrib-connect (formerly grunt-contrib-server), which lets you easily hook in your own middlewares. https://github.com/gruntjs/grunt-contrib-connect#middleware
We're going to use grunt-contrib-connect in the future, so this will make it possible for users to easily hook in this PHP as a middleware.
I'm going to close this for now, but will definitely reopen if we decide to include support for PHP when we explore back-end support.
I hope this is still being considered!
How can this be configured on sytem which has ubuntu 12.10 as its Operating System?