diff --git a/public/.htaccess b/public/.htaccess index 083e7d0..db7927e 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -31,6 +31,23 @@ RewriteCond %{QUERY_STRING} . RewriteRule ^uploads/(.+)\.(jpe?g|png)$ media.php?url=uploads/$1.$2 [NC,QSA,L] + # AddEncoding allows you to have certain browsers uncompress information on the fly. + AddEncoding gzip .gz + + #Serve gzip compressed CSS files if they exist and the client accepts gzip. + RewriteCond %{HTTP:Accept-encoding} gzip + RewriteCond %{REQUEST_FILENAME}\.gz -s + RewriteRule ^(.*)\.css $1\.css\.gz [QSA] + + # Serve gzip compressed JS files if they exist and the client accepts gzip. + RewriteCond %{HTTP:Accept-encoding} gzip + RewriteCond %{REQUEST_FILENAME}\.gz -s + RewriteRule ^(.*)\.js $1\.js\.gz [QSA] + + # Serve correct content types, and prevent mod_deflate double gzip. + RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1] + RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1] + # Send Requests To Front Controller... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f diff --git a/vite.config.js b/vite.config.js index ceb434d..5b5923a 100644 --- a/vite.config.js +++ b/vite.config.js @@ -23,10 +23,10 @@ export default defineConfig({ refresh: true, }), analyzer({ summaryOnly: true }), - // compression({ - // include: [/\.(js)$/, /\.(css)$/], - // deleteOriginalAssets: true, - // }), + compression({ + include: [/\.(js)$/, /\.(css)$/], + // deleteOriginalAssets: true, + }), ], css: { preprocessorOptions: {