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.
Leave a Reply