Once enabled, Cloudflare's Auto minify will minify your HTML and your cached CSS & JS files. If you view the source of your files in your web browser or via a command line tool such as cURL and you do not see the code being minified - here are some things you should check:
- Only files that are served via your orange-clouded DNS records will be minified - so code on 3rd party domains that are not using Cloudflare will not be minified
- For CSS & JS only cache HITs will be minified - use this guide to check an individual file's cache status.
- The feature will deliberately skip minification for files that contain
.minin their name
- If your code has fatal syntax errors, auto minify may not be able to successfully minify the code - use the syntax checkers below on your files to confirm this
- We will not minify inline js/css inside your html
If you want to manually confirm whether your files are getting minified, you can use a tool such as cURL to compare the response with and without Cloudflare - use this guide to learn how to do that or you can view the source code in your browser directly.
To check the syntax of your HTML / CSS or JS files we recommend using online validators / tools such as the following to look for potential issues:
- HTML: https://validator.w3.org/
- CSS: http://jigsaw.w3.org/css-validator/
If you see that minification still isn’t taking effect after checking these steps, please contact Cloudflare Support. You should include the URLs of the resources that you are seeing issues with.
Note CSS & JS minification will operate on cached CSS and JS files only. Once Cloudflare returns a cache HIT for the file it will be returned to browsers in minified form. This allows us to deliver a more complete minification result. If you need to enable or disable minification for CSS & JS you will now need to purge your Cloudflare cache to see the effect of any minification setting change.