Skip to content

Instantly share code, notes, and snippets.

View ducksoupdev's full-sized avatar

Matt Levy ducksoupdev

View GitHub Profile
@lovetingyuan
lovetingyuan / jsdom-prerender.js
Created December 22, 2020 07:15
use jsdom to prerender simple page.
const jsdom = require("jsdom");
const { JSDOM } = jsdom;
const path = require('path')
const fetch = require('node-fetch')
const finalhandler = require('finalhandler')
const http = require('http')
const serveStatic = require('serve-static')
function createServer (port, root = path.join(__dirname, 'dist')) {
const serve = serveStatic(root)
@addyosmani
addyosmani / workbox.md
Last active January 20, 2024 16:14
Workbox recipes

Workbox runtime caching recipes

Your Service Worker script will need to import in Workbox and initialize it before calling any of the routes documented in this write-up, similar to the below:

importScripts('workbox-sw.prod.v1.3.0.js');
const workbox = new WorkboxSW();

// Placeholder array populated automatically by workboxBuild.injectManifest()