How to minify CSS

I am trying to find a way to minify my main css file without using plugin. But tried this method

<link rel="stylesheet" href="{{ ['assets/less/theme.less']|theme| minify }}" media="all">

The code above does not work and wondering what’s the best method to minify the css files?

You can set this in 2 places:

  1. config/cms.php → change this property ‘enable_asset_minify’ => env(‘CMS_ASSET_MINIFY’, true)
  2. .env → add or change “CMS_ASSET_MINIFY=true”
1 Like

Thank you for the detailed solution