<commit_before>importScripts('/bower_components/sw-toolbox/sw-toolbox.js');

var VERSION = 4

self.addEventListener('install', function (event) {
    event.waitUntil(self.skipWaiting())
});

self.addEventListener('activate', function (event) {
    event.waitUntil(self.clients.claim())
});

toolbox.router.get('/(images|js|css|bower_components)/*', toolbox.fastest, {
    cache: {
        name: 'blog-assets-' + VERSION,
        maxEntries: 31
    }
});

toolbox.router.get('/:slug?', toolbox.fastest, {
    cache: {
        name: 'blog-pages-' + VERSION,
        maxEntries: 31
    }
});

// Google APIs
// currently not working as expected
// https://github.com/GoogleChrome/sw-toolbox/issues/125
toolbox.router.get('/*', toolbox.fastest, {
    debug: true,
    origin: 'https://fonts.(googleapis|gstatic).com',
    cache: {
        name: 'googleapi-' + VERSION,
        maxEntries: 31,
    }
});<commit_msg>Use RegExg in sw-toolbox options.origin<commit_after>importScripts('/bower_components/sw-toolbox/sw-toolbox.js');

var VERSION = 4

self.addEventListener('install', function (event) {
    event.waitUntil(self.skipWaiting())
});

self.addEventListener('activate', function (event) {
    event.waitUntil(self.clients.claim())
});

toolbox.router.get('/(images|js|css|bower_components)/*', toolbox.fastest, {
    cache: {
        name: 'blog-assets-' + VERSION,
        maxEntries: 31
    }
});

toolbox.router.get('/:slug?', toolbox.fastest, {
    cache: {
        name: 'blog-pages-' + VERSION,
        maxEntries: 31
    }
});

// Google APIs
// currently not working as expected
// https://github.com/GoogleChrome/sw-toolbox/issues/125
toolbox.router.get('/*', toolbox.fastest, {
    debug: true,
    origin: /https:\/\/fonts.(googleapis|gstatic).com/,
    cache: {
        name: 'google-fonts-' + VERSION,
        maxEntries: 31,
    }
});
{'fraction_non_alphanumeric': 0.1766612641815235, 'fraction_numerical': 0.010804970286331712, 'mean_word_length': 3.228310502283105, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2685455', 'n_tokens_mistral': 648, 'n_tokens_neox': 626, 'n_words': 100}