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 multiroute prerendering #192

Merged
merged 4 commits into from
Jul 5, 2017
Merged

Added multiroute prerendering #192

merged 4 commits into from
Jul 5, 2017

Conversation

framp
Copy link
Contributor

@framp framp commented Jul 5, 2017

This PR adds support for prerendering a set of routes instead of limiting to / (as per #185 (comment))

In order to use this functionality, you have to add a prerender-urls.json file, which contains the set of routes you want to render.
The format for the file is an array of objects with a url key and an optional title key which will override the title.
Eg:

[{"url": "/", "title": "Homepage"}, { "url": "/route/random"}]

I've added a --prerenderUrls option which let you change the path of the prerender-urls.json to whatever you like.

Feedbacks appreciated :)

Copy link
Collaborator

@rkostrzewski rkostrzewski left a comment

Choose a reason for hiding this comment

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

Love it ❤️

@rkostrzewski rkostrzewski merged commit db1641e into preactjs:master Jul 5, 2017
@rkostrzewski rkostrzewski added this to the 1.4.0 milestone Jul 5, 2017
@lukeed
Copy link
Member

lukeed commented Jul 5, 2017

This is great 😃 Thanks!

@carlosagsmendes
Copy link

Dear @framp with the following URLs configuration for the included sample:

[ { "url": "/", "title": "Homepage" }, { "url": "/profile ", "title": "Overriden Profile Title" }, { "url": "/profile/john ", "title": "John's Profile" } ]

I'm getting two profile folders pre-rendered:

PreRender Results

Does this seem right?

@framp
Copy link
Contributor Author

framp commented Aug 17, 2017

@carlosagsmendes it does not seem right and it's not possible on a filesystem level.
I suppose it's a visualisation bug in your editor, probably triggered by indexing files in the same directory at a close time.

Do you mind doing a tree or ls -hall from the terminal in your build directory or restarting your editor?

@carlosagsmendes
Copy link

Here's the output after deleting the folder and doing a new build:

LS-Hall

One thing I noticed is that if I do a "Hard Reload" on Chrome on the https://localhost:8080/profile/ Url I don't get the correct page rendered:

HardReload

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.

4 participants