U.S Immigration Guide

Unminified JavaScript and CSS files

Unminified JavaScript and CSS files

How to Fix SEMrush Issues with JavaScript & CSS Files

SEMrush site audits frequently flag JavaScript and CSS issues that may be slowing down your website. These typically include unminified, uncompressed, and uncached files. Let’s break down what these terms mean, why they matter, and how to fix them—especially if you use platforms like WordPress or Squarespace.

What Do These Terms Mean?

  • Unminified Files: These files contain extra spaces, comments, and formatting that aren’t needed by browsers. Minifying JavaScript and CSS removes this clutter to reduce file size and boost load speed.

  • Uncompressed Files: Files that aren't compressed take longer to transfer. Enabling GZIP or Brotli compression can significantly speed up delivery to users.

  • Uncached Files: If your site doesn't leverage browser caching, users’ browsers have to re-download the same files each time they visit, slowing down load times.

Why These Issues Matter

JavaScript and CSS are critical for rendering your site’s layout, fonts, animations, and interactivity. If these files aren’t optimized, your site will load more slowly, causing:

  • Higher bounce rates

  • Lower user engagement

  • Reduced rankings on search engines

That’s why technical SEO includes steps to streamline these resources.

Platform-Specific Solutions

Squarespace

If you're using Squarespace, these issues are typically not fixable manually—the platform handles file optimization behind the scenes. SEMrush may flag them, but you can usually disregard these warnings.

WordPress

With WordPress, you have more control:

  • Use plugins like Autoptimize to minify, compress, and cache JavaScript and CSS files.

  • Choose hosting providers like SiteGround that include built-in performance tools to automate these fixes.

External Files

For third-party files (like Google Fonts or CDN-hosted libraries), optimization is not in your control. Focus instead on optimizing all internal scripts and stylesheets.

Final Recommendations

If your SEMrush audit flags issues with JavaScript or CSS, address internal files by:

  • Minifying and combining them where possible

  • Enabling GZIP compression on your server

  • Implementing browser caching

  • Using a content delivery network (CDN)

For platforms like WordPress, plugins and managed hosting simplify this process. For all others, especially closed platforms like Squarespace, these alerts can often be safely ignored.

Improving these aspects of your site not only enhances speed and UX but also strengthens your SEO performance.

Fix SEMrush JavaScript and CSS issues by implementing best practices such as enabling GZIP compression on Apache and Nginx, and applying browser caching through Apache .htaccess or Nginx config files. Resolve unminified JavaScript and CSS warnings, compress JavaScript and CSS files, and minify CSS and JS to improve site speed. Optimize website speed based on SEMrush site audit optimization insights, reduce page load time, and improve SEO with file optimization. Use WordPress speed optimization plugins and follow technical SEO performance tips to enhance user experience and search rankings effectively.

🔧 Apache Server: Enable Compression and Caching

✅ 1. Enable GZIP Compression

Edit the .htaccess file (usually found in your website root directory) and add the following:

# Enable GZIP Compression

<IfModule mod_deflate.c>

AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/javascript application/x-javascript

AddOutputFilterByType DEFLATE application/json

AddOutputFilterByType DEFLATE application/xhtml+xml application/xml

AddOutputFilterByType DEFLATE image/svg+xml

</IfModule>

✅ 2. Enable Browser Caching

Add this to your .htaccess file as well:

# Enable Browser Caching

<IfModule mod_expires.c>

ExpiresActive On

ExpiresByType image/jpg "access plus 1 year"

ExpiresByType image/jpeg "access plus 1 year"

ExpiresByType image/gif "access plus 1 year"

ExpiresByType image/png "access plus 1 year"

ExpiresByType text/css "access plus 1 month"

ExpiresByType application/pdf "access plus 1 month"

ExpiresByType application/javascript "access plus 1 month"

ExpiresByType application/x-javascript "access plus 1 month"

ExpiresByType application/x-shockwave-flash "access plus 1 month"

ExpiresByType image/x-icon "access plus 1 year"

ExpiresDefault "access plus 2 days"

</IfModule>

🔧 Nginx Server: Enable Compression and Caching

✅ 1. Enable GZIP Compression

Edit your Nginx configuration file (commonly found at /etc/nginx/nginx.conf) and add inside the http {} block:

# Enable GZIP Compression

gzip on;

gzip_disable "msie6";

gzip_vary on;

gzip_proxied any;

gzip_comp_level 6;

gzip_buffers 16 8k;

gzip_http_version 1.1;

gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

✅ 2. Enable Browser Caching

Add this within the server {} block of your site’s config:

# Enable Browser Caching

location ~* \.(jpg|jpeg|png|gif|ico|css|js|pdf)$ {

expires 30d;

add_header Cache-Control "public, no-transform";

}

✅ After Setup