-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Added support for NotFoundRoute, Converted CJSX utils to JSX, Started moving from CoffeeScript to ES6 #37
Conversation
Hey @gesposito, @fson's very nice PR in #40 conflicts with your Coffeescript -> ES6 changes. Would you mind if I merge #40 and then you merge those changes into your PR? |
Sure, go ahead. |
Thanks! |
@@ -12,6 +13,15 @@ module.exports = (pages, pagesReq) -> | |||
handler: pagesReq './_template' | |||
}) | |||
|
|||
# Adds a handler for <NotFoundRoute /> that will serve as a 404 Page | |||
if config.notFound | |||
templates.rootNotFound = Router.createNotFoundRoute({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removal of NotFound https://github.com/rackt/react-router/blob/master/UPGRADE_GUIDE.md#notfound-route could be relevant here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is a stopgap as we'll be adding support for "meta pages" soon like * routes through the coming plugin system (#36 (comment)). I'll be writing up a RFC soon with some thoughts about how the plugin system will work.
Upgrade css-loader to current 0.19.0
@gesposito do you think you could get this merge-ready soon? Want to do another release this weekend or early next week with this fix in it. Thanks! |
Yes, going to give it a try in a couple of hours. |
👍🏻
|
Ok, see the attached commits. |
@gesposito I ended up not merging the 404 page changes. To really make 404 pages work, you have to also configure your http server (e.g. nginx) to serve your fallback page. Once a plugin system lands, we can add support for custom 404 pages alongside the Gatsby Nginx Docker image. |
Love the ES6 conversions though! Keep those coming. You're about done 👍 |
Added support for NotFoundRoute fixes #33 (404 support)
v0.13.x API
It adds
<NotFoundRoute handler={_404}/>
for root_template
.Inside
_404.jsx
we can have an appropriate Component handler for this Route.Since it should be optional and the missing
_404.jsx
template could crash gatsby I added the optional configuration (boolean):notFound
to enable it.
Converted CJSX utils to JSX
Automation
I used
https://github.com/jsdf/coffee-react
for CJSX files.
Conversion
require
are translated toimport
s.JSX tags stay the same.
var
should probably be replaced by eitherlet
orconst
.Started moving from CoffeeScript to ES6
Automation
I used
https://github.com/eventualbuddha/decaffeinate
for supported
coffee
files.Conversion
require
are translated toimport
s.Notes
I left the original
coffee
files in the codebase until it's safe to flip the switch.