CSS is essential in structuring your website and making it look functional. Because of this, if your website goes offline and the CSS is not available in the cache, your website will look broken. In order to achieve this, we cache CSS with service workers, and deliver those CSS files as external resources. In this recipe, we are going to look at how to load CSS offline.
To get started with service workers, you will need to have the service worker experiment feature turned on in your browser settings. If you have not done this yet, refer to the Setting up service workers recipe of Chapter 1, Learning Service Worker Basics. Service workers only run across HTTPS. To find out how to set up a development environment to support this feature, refer to the following recipes of Chapter 1, Learning Service Worker Basics: Setting up GitHub pages for SSL, Setting up SSL for Windows, and Setting up SSL for Mac.