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

Ability to prerender via CLI #27

Open
Ezku opened this issue Dec 11, 2018 · 0 comments
Open

Ability to prerender via CLI #27

Ezku opened this issue Dec 11, 2018 · 0 comments

Comments

@Ezku
Copy link

Ezku commented Dec 11, 2018

Hi,

I have a use case where I want to prerender a react app as part of a build pipeline for static deployment. I'm using parcel for the build step, which means I can't use e.g. prerender-spa-plugin. But your documentation made prerendering seem simple enough I was wondering - why not rig up a CLI script and run prerendering that way?

I'm not sure if this is the right place to tell you about this, but here's a proof of concept that works perfectly for my use case: https://github.com/Ezku/prerenderer-cli

In short, in my project I have a package.json like this:

"scripts": {
    "build": "yarn build:parcel && yarn build:prerender",
    "build:parcel": "yarn parcel build ./src/index.html",
    "build:prerender": "yarn prerender --renderer=jsdom --source=dist --target=dist --renderAfterDocumentEvent=react-render-complete index.html"
  },

Which yields parcel'd and prerender'd output in dist, the default output directory for parcel. I don't need to write any code in the project for this to happen because prerenderer-cli is quite enough.

What do you think? Is this interesting to you? Thanks for the great tool, I'm liking it a lot at this point.

Cheers,
Eevert

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

No branches or pull requests

2 participants