Optimizing your build by minifying CSS and JavaScript

Last modified: March 13th, 2023

Working with a specific static site generator?
Customize CloudCannon's documentation to suit your SSG.

Great! We'll show you documentation relevant to .
You can change this any time using the dropdown in the navigation bar.

CloudCannon optimizes sites to load as fast as possible. CloudCannon minifies CSS with clean-css and JavaScript with esbuild. Externally hosted assets are not optimized.

Filenames containing -min or .min are not minified, as the filename suggests they have been minified already.

All files output from a build are hosted on our CDN. Assets referenced in the HTML and CSS are rewritten to include a unique hash in the URL, which will be seen as ?cchid=abfc7a.... This hash allows files that haven't changed between subsequent builds of your site to remain in the cache, while all other files are purged.

Optimizations are on by default, to toggle optimizations for your site:

  1. Go to the Site Settings / Compressor section
  2. Toggle Minify and serve assets from CDN
  3. Click Update Build Details
Screenshot of compressor settings screen

To turn off optimizations on individual elements, add the .cms-no-rewrite class to the element.

index.html
copied
<a href="/newsletters/january-summary.pdf" class="cms-no-rewrite">Download Latest Newsletter</a>

The element will not have the URL changed to append the cchid, but will have reduced cache performance.

Related links

Open in a new tab