-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Express 4 #127
base: master
Are you sure you want to change the base?
Express 4 #127
Conversation
Now that Express 4 no longer excepts objects as middleware we have to use callbacks instead. To keep asset-rack working in express 4, with some kind of fallback capabilities for express 3, I'm proposing to specify the `Rack#handle` method when adding the rack/asset as middleware. I've also upgraded CoffeeScript, so I could easily bind the class's method to any instance of it with the new fat-arrow syntax. Another problem is the `express.Response#locals` property is no longer a function. Therefore I've added the assets' "locals" property directly to the express instance.
@johngeorgewright I am getting an error when trying to use this with express 4.1.1
|
Never mind, looks like it is choking on coffee-script not being compiled now |
Maybe I'm using a newer version of CoffeeScript? |
The problem is in the switch.js
It could be because I am loading the module in through git and not through a module, not sure. |
I think this would be the problem jashkenas/coffeescript#3279 Coffee-script introduced a breaking change to how requiring coffee-script works. |
Fixing Coffee-script missing module
Good catch. |
This is failing for me on both the latest version of Express ( |
Hey @martindale, are you giving the https://github.com/johngeorgewright/asset-rack/blob/express-4/README.md#getting-started I think that's what was happening to me until I made this pull request. |
Now that Express 4 no longer excepts objects as middleware we have to use callbacks instead.
To keep asset-rack working in express 4, with some kind of fallback capabilities for express 3, I'm proposing to specify the
Rack#handle
method when adding the rack/asset as middleware. I've also upgraded CoffeeScript, so I could easily bind the class's method to any instanceof it with the new fat-arrow syntax.
Another problem is the
express.Response#locals
property is no longer a function. Therefore I've added the assets' "locals" property directly tothe express instance.