This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin') | |
module.exports = { | |
webpack: (config) => { | |
config.plugins.push( | |
new SWPrecacheWebpackPlugin({ | |
verbose: true, | |
staticFileGlobsIgnorePatterns: [/\.next\//], | |
runtimeCaching: [ | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
componentDidMount() { | |
if ("serviceWorker" in navigator) { | |
navigator.serviceWorker | |
.register("/service-worker.js") | |
.then(registration => { | |
console.log("service worker registration successful"); | |
}) | |
.catch(err => { | |
console.warn("service worker registration failed", err.message); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Document, { Head, Main, NextScript } from "next/document"; | |
import flush from "styled-jsx/server"; | |
export default class extends Document { | |
static getInitialProps({ renderPage }) { | |
const { html, head, errorHtml, chunks } = renderPage(); | |
const styles = flush(); | |
return { html, head, errorHtml, chunks, styles }; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require("express"); | |
const cors = require("cors") | |
const { join } = require("path"); | |
const { parse } = require("url"); | |
const next = require("next"); | |
const fetch = require("isomorphic-unfetch") | |
const LRUCache = require('lru-cache') | |
const port = parseInt(process.env.PORT, 10) || 3000; | |
const dev = process.env.NODE_ENV !== "production"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<LazyLoad offset={100}> | |
<figure className="image"> | |
<img src={`https://res.cloudinary.com/{username}/image/fetch/c_scale,fl_force_strip.progressive,w_478/f_webp/${item.thumbnail}`} alt={item.title} /> | |
</figure> | |
</LazyLoad> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'abandoned', | |
'beach', | |
'bike', | |
'birthday', | |
'broken', | |
'breakfast', | |
'business', | |
'cake', | |
'car', | |
'cat', |