Giter Site home page Giter Site logo

tanoscar111 / floema_ Goto Github PK

View Code? Open in Web Editor NEW

This project forked from whizzbbig/floema_

0.0 0.0 0.0 5.38 MB

A repo of Creative Course by luis henrique bizzaro on awwwards which intent to use latest techniques and also has commits according to lecture on awwwards

Home Page: https://floema-ice.vercel.app

JavaScript 60.29% GLSL 1.51% Pug 16.43% SCSS 21.76%

floema_'s Introduction

Hosted and Deployed on Heroku and Vercel

webpack-boilerplate

A boilerplate which inspired from luis henrique bizzaro course on awwwards but intent to use up-to-date technologies.

It has commits according to the lecture of the course

Setup

npm install to install all the dependencies

add .env file to the folder

npm start to run development in your localhost

Migration Guide from @prismicio/client v5 to v6

Step - 1

  • Remove prismic-dom module from file by doing npm uninstall prismic-dom
  • Update @prismicio/client module
  • add @prismicio/helpers and node-fetch by doing npm i @prismicio/helpers [email protected] // don't install the latest v of node-fetch it isn't compatible to cjs env.

Step - 2

  • add PrismicH to the app.js
const PrismicH = require('@prismicio/helpers');
  • replace the declaration of PrismicDOM from PrismicH from everywhere
  • add node-fetch to the app.js
const fetch = require('node-fetch');

things should look like this

const fetch = require('node-fetch');
const logger = require('morgan');
const path = require('path');
const express = require('express');
const errorHandler = require('errorhandler');
const bodyParser = require('body-parser');
const methodOverride = require('method-override');

const app = express();
const port = process.env.PORT || 8004;

const Prismic = require('@prismicio/client');
const PrismicH = require('@prismicio/helpers');
const { application } = require('express');
const UAParser = require('ua-parser-js');

Step - 3

refactor the prismic init

const initApi = (req) => {
  return Prismic.createClient(process.env.PRISMIC_ENDPOINT, {
    accessToken: process.env.PRISMIC_ACCESS_TOKEN,
    req,
    fetch,
  });
};

Step - 4

now we have to fetch all the pages at once to resolve the issue of pages are not loading on time replace this ๐Ÿ‘‡ from your app.js/handleRequest function

  const meta = await api.getSingle('meta');
  const preloader = await api.getSingle('preloader');
  const navigation = await api.getSingle('navigation');
  const home = await api.getSingle('home');
  const about = await api.getSingle('about');
  const { results: collections } = await api.query( Prismic.Predicates.at('document.type', 'collection'), { fetchLinks: 'product.image' } ); // prettier-ignore

to this ๐Ÿ‘‡

  const [meta, preloader, navigation, home, about, { results: collections }] =
    await Promise.all([
      api.getSingle('meta'),
      api.getSingle('preloader'),
      api.getSingle('navigation'),
      api.getSingle('home'),
      api.getSingle('about'),
      api.query(Prismic.Predicates.at('document.type', 'collection'), {
        fetchLinks: 'product.image',
      }),
    ]);

after this all pages are gonna load on time except /about route coz you forgot to refactor PrismicDOM to PrismicH ๐Ÿ˜† les do that also...

Step - 5

replace this ๐Ÿ‘‡ .about__content__description!=PrismicDOM.RichText.asHtml(section.primary.description).replace(/<p>/g, '<p data-animation="paragraph">')

to this ๐Ÿ‘‡

.about__content__description!=PrismicDOM.asHTML(section.primary.description).replace(/<p>/g, '<p data-animation="paragraph">')

now we updated our repo to Prismic v6 :)

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.