Spaces:
Running
Running
Otimize imagens (use WebP, compressão, lazy loading), minimize CSS/JS, use cache,Isso melhora SEO e acessibilidade,Use media queries, flexbox ou grid, ajuste fontes/tamanhos para mobile,Use ferramentas como Lighthouse, axe, ou o audit do Chrome DevTools,Verifique se cada página tem título único e descrição,Se usar bibliotecas, carregue de forma assíncrona ou somente quando preciso,Por exemplo, mostrar mensagem amigável se API não responder, usar placeholders de imagem - Follow Up Deployment
e98fff6 verified | ```javascript | |
| const CACHE_NAME = 'truco-cache-v1'; | |
| const urlsToCache = [ | |
| '/', | |
| '/index.html', | |
| '/styles.css', | |
| '/script.js' | |
| ]; | |
| self.addEventListener('install', event => { | |
| event.waitUntil( | |
| caches.open(CACHE_NAME) | |
| .then(cache => { | |
| return cache.addAll(urlsToCache); | |
| }) | |
| ); | |
| }); | |
| self.addEventListener('fetch', event => { | |
| event.respondWith( | |
| caches.match(event.request) | |
| .then(response => { | |
| if (response) { | |
| return response; | |
| } | |
| return fetch(event.request); | |
| } | |
| ) | |
| ); | |
| }); | |
| ``` | |
| ``` |