Socket
Socket
Sign inDemoInstall

workbox-recipes

Package Overview
Dependencies
7
Maintainers
6
Versions
28
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    workbox-recipes

A service worker helper library to manage common request and caching patterns


Version published
Weekly downloads
3M
decreased by-3.02%
Maintainers
6
Install size
1.74 MB
Created
Weekly downloads
 

Package description

What is workbox-recipes?

The workbox-recipes npm package provides pre-configured, common service worker strategies and behaviors for web applications using Workbox. It simplifies the implementation of caching, offline functionality, and other progressive web app (PWA) features.

What are workbox-recipes's main functionalities?

Offline Page

This feature allows you to specify fallback pages or images when the network is unavailable. The code sample shows how to set up offline fallbacks for both pages and images.

import { offlineFallback } from 'workbox-recipes';

offlineFallback({
  pageFallback: '/offline.html',
  imageFallback: '/static/images/offline.jpg'
});

Static Resource Caching

Enables caching for static resources such as CSS and JavaScript files. The code sample demonstrates pre-caching specific URLs on service worker installation.

import { staticResourceCache } from 'workbox-recipes';

staticResourceCache({
  warmupUrls: ['/styles/main.css', '/scripts/main.js']
});

Google Fonts Caching

Provides a simple method to cache Google Fonts used on your web pages, enhancing performance and reducing data usage.

import { googleFontsCache } from 'workbox-recipes';

googleFontsCache();

Other packages similar to workbox-recipes

Readme

Source

This module's documentation can be found at https://developers.google.com/web/tools/workbox/modules/workbox-recipes

Keywords

FAQs

Last updated on 03 Mar 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc