CSS not being minified

Hi! I activated the CSS minification in the “Asset optimization” settings but it seems to be ignored: https://the-menu.netlify.com/styles.css

How can I solve this?

I also tried uploading this netlify.toml file in the root folder of the repo:

[build.processing]
  skip_processing = false
[build.processing.css]
  bundle = false
  minify = true
[build.processing.js]
  bundle = false
  minify = false
[build.processing.html]
  pretty_urls = false
[build.processing.images]
  compress = true

But nothing changed :frowning:

hi @luiscastro193 - some questions:

does it minify locally?
Is your build process otherwise working correctly?
are you getting any errors in your build logs?
what ssg are you using?

this is helpful to figure it out :slight_smile:

Hi, thanks for answering.

does it minify locally? I don’t really understand the question but locally the file is not minified in any form. I was hoping for it to be minified by Netlify when published.

Is your build process otherwise working correctly? Yes, perfectly.

are you getting any errors in your build logs? Nope

what ssg are you using? None. Just custom html and javascript. The css file is explicitly referenced in index.html though so it shouldn’t be a problem.

hi, thanks for clarifying. I wasn’t sure if you were using a build pipeline with a minification step that wasn’t executing correctly, but as you are using html/css only, you are likely referring to the Netlify asset optimization, is that correct?

is yes, this article might be helpful, i’d start there. If you still can’t make it work, let us know, and we’d probably need to see your netlify.toml to be able to really say.

Yes, that’s correct :slight_smile:

I tried this netlify.toml: previous comment

It didn’t work though. The CSS file is explicitly referenced at index.html so that’s not the problem.

hmm. can you post a screenshot of your asset minimization settings in dashboard please?

assets_optimization

OK, let’s reboot - there are some caveats to our asset optimization you should know about that are mentioned in this article:

Specifically:

  • files must be linked from some other file in your site
  • in an appropriate way (/path/to/file rather than https://URL or file)
  • and you must redeploy after updating the setting.

We don’t intend to optimize every image type - only some and only what we can do losslessly.

Take a look at that article and if you are still missing some optimization, please share:

  • a link to the page that refers to the asset
  • and what the asset is

so we can take a closer look.

I think the problem was that the file is at the root folder. I tried linking it as file and as ./file but neither worked, presumably because those are not “appropiate ways”.

I have given up by now since it’s not that big of a deal but that would be my guess. Anyway, thanks for the help!