GithubHelp home page GithubHelp logo

alvarotf / angular-7-prerender-with-prismic.io Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 76 KB

Using Angular Universal to prerender content from Prismic.io

TypeScript 93.30% HTML 5.19% CSS 1.52%

angular-7-prerender-with-prismic.io's Introduction

๐Ÿ’ฅ Angular 7 Prerender with content from Prismic.io

This project is based on the Angular Universal Starter project and demonstrates how to use Angular Universal for prerendering content from Prismic.io

Prerendering gives an Angular SPA the speed and SEO friendliness of a static website without the need of a server.

Prismic is a Headless CMS.

โญ Comparison of SSR and Prerender

Goal SSR Prerendering
performance fast fastest
hosting cost ~$30/m $0
complexity highest lowest
static hosting No Yes
scale limitations Unlimited Yes

(from AngularFirebase)

Details

  • Uses ZoneMacroTaskWrapper encapsulated on async-api-call-helper.service.ts to make Angular Universal wait for Prismic API calls before rendering.
  • Uses TransferState service to prevent flickering in the server to browser transition.

Build Time Prerendering

Prerender

  • Happens at build time
  • Renders your application and replaces the dist index.html with a version rendered at the route /.

Installation

  • npm install or yarn

Development (Client-side only rendering)

  • run npm run start which will start ng serve

Production (also for testing Pre-rendering locally)

npm run build:prerender && npm run serve:prerender - Compiles your application and prerenders your applications files, spinning up a demo http-server so you can view it on http://localhost:8080 Note: To deploy your static site to a static hosting platform you will have to deploy the dist/browser folder, rather than the usual dist

angular-7-prerender-with-prismic.io's People

Contributors

alvarotf avatar

Stargazers

 avatar Harlen Giraldo avatar Jiri Puc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.