support for serving php files #270

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
9 participants
@fgnass
Contributor

fgnass commented Aug 30, 2012

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.

@addyosmani

This comment has been minimized.

Show comment
Hide comment
@addyosmani

addyosmani Aug 30, 2012

Member

Nice work! Some interesting refactoring going on there :)

Thoughts:

  • Lets test this to make sure the introduction of tamper and gateway doesn't cause any breakages elsewhere
  • That these additional dependencies don't add that much extra time to the installation process
  • The modifications to server pass tests, continue serving correctly other content and so on.

Concerns:

  • We're aiming to launch on Monday. Is it a good idea for us to consider this so closely? leave for V2?
  • Does merging open up a gateway for developers asking us to add other language-specific additions?
Member

addyosmani commented Aug 30, 2012

Nice work! Some interesting refactoring going on there :)

Thoughts:

  • Lets test this to make sure the introduction of tamper and gateway doesn't cause any breakages elsewhere
  • That these additional dependencies don't add that much extra time to the installation process
  • The modifications to server pass tests, continue serving correctly other content and so on.

Concerns:

  • We're aiming to launch on Monday. Is it a good idea for us to consider this so closely? leave for V2?
  • Does merging open up a gateway for developers asking us to add other language-specific additions?
@fgnass

This comment has been minimized.

Show comment
Hide comment
@fgnass

fgnass Aug 30, 2012

Contributor

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.

Contributor

fgnass commented Aug 30, 2012

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.

@mklabs

This comment has been minimized.

Show comment
Hide comment
@mklabs

mklabs Aug 30, 2012

Contributor

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.

Contributor

mklabs commented Aug 30, 2012

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.

@fgnass

This comment has been minimized.

Show comment
Hide comment
@fgnass

fgnass Aug 30, 2012

Contributor

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.

Contributor

fgnass commented Aug 30, 2012

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.

@paulirish

This comment has been minimized.

Show comment
Hide comment
@paulirish

paulirish Aug 31, 2012

Member

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.

Member

paulirish commented Aug 31, 2012

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.

@pederan

This comment has been minimized.

Show comment
Hide comment
@pederan

pederan Sep 17, 2012

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

pederan commented Sep 17, 2012

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

@blueyestar

This comment has been minimized.

Show comment
Hide comment
@blueyestar

blueyestar Sep 30, 2012

I have tried gateway and tamper. They can not work properly, following error occurred.
Can't set headers after they are sent.

I have tried gateway and tamper. They can not work properly, following error occurred.
Can't set headers after they are sent.

@fgnass

This comment has been minimized.

Show comment
Hide comment
@fgnass

fgnass Sep 30, 2012

Contributor

@blueyestar That issue should have been fixed in gateway@0.1.1. 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

Contributor

fgnass commented Sep 30, 2012

@blueyestar That issue should have been fixed in gateway@0.1.1. 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

@sindresorhus

This comment has been minimized.

Show comment
Hide comment
@sindresorhus

sindresorhus Nov 7, 2012

Member

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.

Example:
https://github.com/gruntjs/grunt-contrib-connect/blob/master/Gruntfile.js#L30-37

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.

Member

sindresorhus commented Nov 7, 2012

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.

Example:
https://github.com/gruntjs/grunt-contrib-connect/blob/master/Gruntfile.js#L30-37

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.

@KingScooty

This comment has been minimized.

Show comment
Hide comment
@KingScooty

KingScooty Jan 17, 2013

I hope this is still being considered!

I hope this is still being considered!

@ekancepts

This comment has been minimized.

Show comment
Hide comment
@ekancepts

ekancepts Feb 11, 2013

How can this be configured on sytem which has ubuntu 12.10 as its Operating System?

How can this be configured on sytem which has ubuntu 12.10 as its Operating System?

@sindresorhus sindresorhus referenced this pull request Mar 8, 2013

Closed

Docs for 1.0 #829

8 of 14 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment