Skip to content
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

Merged
merged 8 commits into from Oct 3, 2015

Conversation

gesposito
Copy link
Contributor

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 to imports.

JSX tags stay the same.

var should probably be replaced by either let or const.

Started moving from CoffeeScript to ES6

Automation

I used
https://github.com/eventualbuddha/decaffeinate
for supported coffee files.

Conversion

require are translated to imports.

Notes

I left the original coffee files in the codebase until it's safe to flip the switch.

@gesposito gesposito changed the title Added support for NotFoundRoute, Converted CJSX utils to JSX Added support for NotFoundRoute, Converted CJSX utils to JSX, Started moving from CoffeeScript to ES6 Sep 21, 2015
@KyleAMathews
Copy link
Contributor

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?

@KyleAMathews KyleAMathews mentioned this pull request Sep 23, 2015
@gesposito
Copy link
Contributor Author

Sure, go ahead.

@KyleAMathews
Copy link
Contributor

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({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

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.

@KyleAMathews
Copy link
Contributor

@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!

@gesposito
Copy link
Contributor Author

Yes, going to give it a try in a couple of hours.

@KyleAMathews
Copy link
Contributor

👍🏻
On Fri, Sep 25, 2015 at 11:13 AM Gianluca Esposito notifications@github.com
wrote:

Yes, going to give it a try in a couple of hours.


Reply to this email directly or view it on GitHub
#37 (comment).

@gesposito
Copy link
Contributor Author

Ok, see the attached commits.

@KyleAMathews KyleAMathews merged commit 63d5cd6 into gatsbyjs:master Oct 3, 2015
@KyleAMathews
Copy link
Contributor

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

@KyleAMathews
Copy link
Contributor

Love the ES6 conversions though! Keep those coming. You're about done 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for pagination and categories/tags
3 participants