- Use responsive images
- Inline critical CSS (if the CSS is <50k probably worth inlining everyhing)
- Use a web font loading strategy, eg. https://www.filamentgroup.com/lab/font-events.html
- Configure your server to handle gzip, etags... correctly https://github.com/h5bp/server-configs-apache
- Load JavaScript async
- Use a CDN (be sure to think about fallback scenarios)
- Use Service Worker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="background"></div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Test 1: | |
1) Cloned the repo | |
2) Started Server via | |
``` | |
npm install http-server -g | |
http-server -c-1 | |
''' | |
3) Opened page https://localhost:8080/ | |
4) Reloaded - got console message "This page is controlled by a ServiceWorker" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Request URL:http://localhost/sw/2/simple-serviceworker-tutorial/script.js | |
Request Method:GET | |
Status Code:200 OK (from ServiceWorker) | |
Request Headers | |
Provisional headers are shown | |
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 | |
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.111 Safari/537.36 | |
Response Headers | |
accept-ranges:bytes | |
content-encoding:gzip |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Remote Address:127.0.0.1:80 | |
Request URL:http://localhost/sw/2/simple-serviceworker-tutorial/script.js | |
Request Method:GET | |
Status Code:200 OK | |
Request Headersview source | |
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 | |
Accept-Encoding:gzip, deflate, sdch | |
Accept-Language:en,en-US;q=0.8,de-DE;q=0.6,de;q=0.4 | |
Cache-Control:no-cache | |
Connection:keep-alive |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IE7 | |
hyphens - | |
word-break + | |
overflow-wrap + | |
hyphens + word-break combined - | |
hyphens + overflow hyphens combined + | |
IE8 | |
hyphens - | |
word-break + |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="background"></div> |
Thoughts about a way to progressive enhance the technique to control CSS loading by Jake Archibald.
My idea was to set a class for html (which gets changed if custom properties are supported) and in the CSS use:
.no-ccp footer {
display: block;
}
footer {
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.user-style-justmarkup { | |
--color1: #118C3C; | |
--color2: #fff; | |
--color3: #9FD1B1; | |
--color4: rgba(0, 0, 0, 0.05); | |
--color5: rgba(17,140,60,0.25); | |
--color6: #E7F3EB; | |
--color7: #C3E2CE; | |
--color8: #0D7030; | |
--color9: #0A5424; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
if (navigator.serviceWorker) { | |
navigator.serviceWorker.register('./serviceworker.js', { | |
scope: './' | |
}); | |
} | |
</script> |