I fail to set up LessCss filter with asset_compress plugin on a new CakePHP4 app. Read the docs: https://github.com/markstory/asset_compress/wiki There are some examples on js filters and config in general, so I set up mine like so:
[General]
cacheConfig = false
[js]
cachePath = WEBROOT/cache_js/
[css]
cachePath = WEBROOT/cache_css/
[less]
filters[] = LessCss
[app-v1.css]
files[] = WEBROOT/less/app-v1.less
What happens is app-v1.less get parsed like a css file, so all the Less stuff is still there and not processed properly.
When adding filters[] = LessCss
to [css]
or [app-v1.css]
get an error:
Error: /usr/local/lib/node_modules/less/dist/less.cjs.js:6735
imports.contents[fileInfo.filename] = str;
^
TypeError: Cannot read property 'contents' of undefined
at Object.parse (/usr/local/lib/node_modules/less/dist/less.cjs.js:6735:20)
at Object.<anonymous> (/Users/yy/www/fudis_app/tmp/asset_compress_less6IDAL9:5:8)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:420:7)
at startup (bootstrap_node.js:139:9)
I understand this is a general question and possibly I am missing something in the docs or general understanding, but a simple example of a proper config would be really handy. Thanks!