All Projects → ABuffSeagull → parcel-plugin-prerender

ABuffSeagull / parcel-plugin-prerender

Licence: MIT license
No description or website provided.

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to parcel-plugin-prerender

Prerender Spa Plugin
Prerenders static HTML in a single-page application.
Stars: ✭ 7,018 (+16609.52%)
Mutual labels:  static-site-generator, spa, seo, prerender
React Snap
👻 Zero-configuration framework-agnostic static prerendering for SPAs
Stars: ✭ 4,565 (+10769.05%)
Mutual labels:  static-site-generator, seo, prerender
vue-seo-friendly-spa-template
Vue.js PWA/SPA template initially scaffolded with vue-cli and configured for SEO. Makes use of prerendering and other techniques/packages in order to achieve a perfect "Lighthouse Score".
Stars: ✭ 41 (-2.38%)
Mutual labels:  spa, seo, prerender
react-seo-friendly-spa-template
React PWA/SPA template initially scaffolded with CRA (Create React App) and configured for SEO. Makes use of prerendering and other techniques/packages in order to achieve a perfect "Lighthouse Score".
Stars: ✭ 24 (-42.86%)
Mutual labels:  spa, seo, prerender
crisp-react
React boilerplate written in TypeScript with a variety of Jamstack and full stack deployments. Comes with SSR and without need to learn a framework. Helps to split a monolithic React app into multiple SPAs and avoid vendor lock-in.
Stars: ✭ 147 (+250%)
Mutual labels:  static-site-generator, prerender
Rust Webapp Starter
Rust single page webapp written in actix-web with vuejs.
Stars: ✭ 151 (+259.52%)
Mutual labels:  spa, parcel
Vuepress
📝 Minimalistic Vue-powered static site generator
Stars: ✭ 19,730 (+46876.19%)
Mutual labels:  static-site-generator, seo
React Firebase Starter
Boilerplate (seed) project for creating web apps with React.js, GraphQL.js and Relay
Stars: ✭ 4,366 (+10295.24%)
Mutual labels:  spa, seo
Ng Static Site Generator
ng-static-site-generator is a webpack-based command line build tool that builds an Angular app and Jekyll-style blog entry html files into a static html and css website. It also supports building a client app so you can have static pages that are also capable of running dynamic functionality coded in Angular.
Stars: ✭ 42 (+0%)
Mutual labels:  static-site-generator, prerender
Elderjs
Elder.js is an opinionated static site generator and web framework for Svelte built with SEO in mind.
Stars: ✭ 1,102 (+2523.81%)
Mutual labels:  static-site-generator, seo
parcel-plugin-externals
Parcel plugin for declaring externals. These externals will not be bundled. 📦
Stars: ✭ 47 (+11.9%)
Mutual labels:  parcel, parcel-plugin
Rendora
dynamic server-side rendering using headless Chrome to effortlessly solve the SEO problem for modern javascript websites
Stars: ✭ 1,853 (+4311.9%)
Mutual labels:  spa, seo
Preact Redux Isomorphic
preact-redux-isomorphic PWA SPA SSR best practices and libraries in under 80kB page size (for live demo click the link below)
Stars: ✭ 85 (+102.38%)
Mutual labels:  spa, seo
Elm Pages
A statically typed site generator for Elm.
Stars: ✭ 363 (+764.29%)
Mutual labels:  static-site-generator, seo
Photo Blog
The Photo Blog Application based on Laravel 5 and Vue.js 2 + Prerender
Stars: ✭ 55 (+30.95%)
Mutual labels:  spa, prerender
react-redux-boilerplate
A React boilerplate based on Redux, React Router, styled components and Parcel
Stars: ✭ 62 (+47.62%)
Mutual labels:  spa, parcel
example-app
Example app showcasing fulls1z3's Angular libraries
Stars: ✭ 27 (-35.71%)
Mutual labels:  spa, seo
Presite
A static site generator based on Puppeteer.
Stars: ✭ 280 (+566.67%)
Mutual labels:  spa, prerender
Gatsby Advanced Starter
A high performance skeleton starter for GatsbyJS that focuses on SEO/Social features/development environment.
Stars: ✭ 1,224 (+2814.29%)
Mutual labels:  static-site-generator, seo
acblog
An open source extensible static & dynamic blog system. (an alternative tool with same features at StardustDL/paperead)
Stars: ✭ 60 (+42.86%)
Mutual labels:  static-site-generator, spa

parcel-plugin-prerender

Known Vulnerabilities

About

Much like the prerender-spa-plugin for Webpack, this plugin is to bring prerendering capabilities to Parcel. It is meant to be a drop-in solution for any site or single-page-app.

Installation

npm install parcel-plugin-prerender -D

Usage

By default, this plugin will render the / path when building with parcel (i.e. parcel build or process.env.NODE_ENV == "production"). As this plugin uses cosmiconfig, in order to configure the plugin, pass the configuration options in a prerender key in your package.json, or a JSON or YAML .prerenderrc file, or export the config object in a prerender.config.js file.

Example

If you just want to render multiple routes, you can pass a plain array in any of the above ways:

// .prerenderrc
["/", "/about", "/login", "/deep/nested/route"]

Otherwise, you must pass it in a routes key, in order to configure the renderer, as follows.

Render configuration

You can configure the renderer (browser) options by using the following example config:

{
  "routes": ["/", "/about"],
  "rendererConfig": {
    "renderAfterDocumentEvent": "prerender-trigger"
  }
}

This is particularly useful if you'd like to pre-fetch some API data or async config and make that part of your pre-rendered HTML.

In the example above, the / and /about pages will only be rendered when the custom DOM event prerender-trigger is dispatched.

You can do so in your code like the following:

document.dispatchEvent(new Event('prerender-trigger'));

The custom configuration can also be useful for debugging. If the resulting html does not look like what you're expecting you could use the following configuration:

{
  "routes": ["/", "/about"],
  "rendererConfig": {
    "headless": false
  }
}

To make the pre-render browser visible and you would be available to debug.

To see all the options available see this documentation

What is Prerendering?

To quote prerender-spa-plugin:

Recently, SSR (Server Side Rendering) has taken the JavaScript front-end world by storm. The fact that you can now render your sites and apps on the server before sending them to your clients is an absolutely revolutionary idea (and totally not what everyone was doing before JS client-side apps got popular in the first place...)

However, the same criticisms that were valid for PHP, ASP, JSP, (and such) sites are valid for server-side rendering today. It's slow, breaks fairly easily, and is difficult to implement properly.

Thing is, despite what everyone might be telling you, you probably don't need SSR. You can get almost all the advantages of it (without the disadvantages) by using prerendering. Prerendering is basically firing up a headless browser, loading your app's routes, and saving the results to a static HTML file. You can then serve it with whatever static-file-serving solution you were using previously. It just works with HTML5 navigation and the likes. No need to change your code or add server-side rendering workarounds.

In the interest of transparency, there are some use-cases where prerendering might not be a great idea.

  • Tons of routes - If your site has hundreds or thousands of routes, prerendering will be really slow. Sure you only have to do it once per update, but it could take ages. Most people don't end up with thousands of static routes, but just in-case...
  • Dynamic Content - If your render routes that have content that's specific to the user viewing it or other dynamic sources, you should make sure you have placeholder components that can display until the dynamic content loads on the client-side. Otherwise it might be a tad weird.

Available Renderers

Currently only @prerenderer/renderer-puppeteer is supported, although @prerenderer/renderer-jsdom will probably be supported in the future

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].