Skip to content

brycedorn/react-snap-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-snap action

Test SSR

This action uses react-snap to pre-render a web application into static, hydratable HTML.

If your node-based web application has a build script that outputs HTML, this action will render it and update the index.html within output directory with the result. This can then easily be deployed to GitHub pages, etc and you'll have some of the benefits of server-side rendering (SSR) without needing a server!

While you can include react-snap as a dependency to directly your project, puppeteer is heavy and headless Chrome is overkill for a simple web app. This also simplifies the configuration required to enable them to run in CI.

Usage

jobs:
  prerender:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout 🛎️
        uses: actions/checkout@v3
      
      - name: Server-side render
        uses: brycedorn/react-snap-action@v1.0.2

For input options see action.yml.

Why use this?

  • Enables SEO for SPAs. Web crawlers only care about <meta> tags in HTML markup, not those rendered client-side.
  • Better performance. As the server frontloads the expensive initial render once, clients only need to hydrate to render the app.