Skip to content

Commit

Permalink
feat: improve service worker
Browse files Browse the repository at this point in the history
  • Loading branch information
greatislander committed Apr 18, 2024
1 parent 62ed317 commit c8ed4c4
Show file tree
Hide file tree
Showing 5 changed files with 12,868 additions and 8,596 deletions.
21 changes: 21 additions & 0 deletions eleventy.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ https://github.com/inclusive-design/acaw-cama/raw/main/LICENSE.md.
const fluidPlugin = require("eleventy-plugin-fluid");
const navigationPlugin = require("@11ty/eleventy-navigation");
const { EleventyI18nPlugin } = require("@11ty/eleventy");
const pluginPWA = require("eleventy-plugin-pwa-v2");
const getYouTubeID = require("get-youtube-id");
const title = require("title");
const rosetta = require("rosetta");
Expand Down Expand Up @@ -83,6 +84,26 @@ module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(fluidPlugin, {
i18n: false
});
eleventyConfig.addPlugin(pluginPWA, {
swDest: "./_site/sw.js",
globDirectory: "./_site",
cacheId: "acaw-cama",
globIgnores: [],
runtimeCaching: [
{
urlPattern: /\/$/,
handler: "NetworkFirst"
},
{
urlPattern: /\.html$/,
handler: "NetworkFirst"
},
{
urlPattern: /^.*\.(jpg|png|mp4|gif|webp|ico|svg|woff2|woff|eot|ttf|otf|ttc|json)$/,
handler: "StaleWhileRevalidate"
}
]
});

return {
dir: {
Expand Down
Loading

0 comments on commit c8ed4c4

Please sign in to comment.