Open Findus23 opened 3 years ago
Implementing the latter is really easy
Unfortunately there are other things that make this much harder as expected: Instead of (as I expected) generating a list of LESS imports for all files and compiling this getConcatenatedAssets()
already appends all files into one huge LESS file meaning any information about files is already lost before the LESS compiler.
This is one thing that in my opinion would make developing CSS in Matomo a lot easier and more fun. And now that we are using
wikimedia/less.php
it is finally possible to achieve:Issues like https://github.com/matomo-org/matomo/issues/16983 are unnecessarily hard to debug as all you see in the browser developer tools is
index.php:774
which contains a huge amount of CSS.Instead (probably only when development mode is enabled) Matomo should add an endpoint like
/index.php?module=Proxy&action=getCssSourcemap
that returns the CSS sourcemap, add a link to it at the end of the CSS output and therefore allow the browser to show helpful things likesomefile.less:123
allowing to immediatly fix the right file.Reasons why this might not be completely trivial (but still probably not that complex):
If this is too much work, there would be an easier method that only needs a rewrite of the LESS compilation code:
$options = array( 'sourceMap' => true );
and therefore append the sourcemap to the CSS file