Compressing/Minifying MailChimp’s mc-validate.js

no alt text set

MailChimp has been far from 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

//s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js

in 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.

If you found this post useful ...

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

2
Leave a Reply

avatar

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

  Subscribe  
newest oldest most voted
Notify of
testing
Guest
testing

Thanks for this. But, one question. Where can I find it? The call to this script. /s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js