If you submit valid CSS and JS, Shopify minify’s automatically. The only time I find my files aren’t is when something is invalid or broken in them.> > Validate your CSS files here:> https://jigsaw.w3.org/css-validator/> > There are a number of JS validators online too. Nothing “official” thought that I’m aware of.
All JavaScript files requested from the storefront are minified by default given that they are called using the following syntax:
{{- 'some-script.js' | asset_url | script_tag -}}
However, if your files contains any ES6 statements like:
“let” keyword
“const” keyword
arrow functions
default function parameters
then your JS file won’t be minified automatically. This is apparently not documented anywhere and I spent hours trying to figure out the catch here. Might be helpful for some in the future.