Compressing/Minifying MailChimp’s mc-validate.js

no alt text set

MailChimp has not be cooperative with helping developers speed up website loading by simply minifying their mc-validate.js file. There’s a growing thread on Twitter started over two — yes, 2! — years ago!

Here’s what i did to stop receiving terrible grades on GT Metrix and Google’s PageSpeed Insights.

Replace the //s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js src in the default MailChimp embed code with the code in my gist. I prepended “local” to the default file name like so local-mc-validate.js and serve it on my own server. I took the MailChimp mc-validate.js file and minified it via https://javascript-minifier.com/ to produce this

You’ll also need to supply a local, minified version of the .css file MailChimp uses horizontal-slim-10_7.css. Rename it to something like local-horizontal-slim-10_7.css just like the .js file.

Here’s the gist.

Hope that helps you speed up your websites.

Be sure to check out the two sister posts on leveraging browser caching and gzip compression.

Wondering why you keep seeing lowercased 'i' in my posts? Read -> Why ‘i’ is not capitalized

Leave a Reply

avatar

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
Notify of