Whilst this is still on my mind....
When I was in the process of fixing the RTL issues for Essential: https://moodle.org/mod/forum/discuss.php?d=264952#p1148492 - I realised that with theme designer mode off (TDM off) that the detection code in the theme's config.php was not switching to use different files. This mechanism worked for swatch switching in Mutant Banjo (MB), but why not here? So I realised that MB performed a theme cache purge. However for RTL this is not practical as it affects everybody.
The reason it is an issue is because all of the CSS is compacted into one file called 'all'. This is potentially great for HTTP requests and caching everything you need locally once, but perhaps not so great if you are a mobile user and bandwidth / local storage is an issue. And in any event why should the file be so big when it contains css that you will never use? Just like the instructions manuals you get with fourteen languages warning you that your iron will be hot when you turn it on.
So....
What about compartmentalising the CSS files into separate ones, perhaps all of the generic CSS and then specific language targeted CSS depending on the language being used? To have two requests instead of one. A small price to pay.
I did think that this could be done by a theme already through serving up the CSS files itself and bypassing the core caching process - even better with production minimised versions of the files as well as developer friendly copies. But what about custom CSS? That needs to be appended at the end and is placed in the cached 'all' file, so any theme served file would be after it. Or so I thought as I came to the conclusion that core really needs theme configuration that has $THEME->ltrsheets and $THEME->rtlsheets instead of the combined $THEME-sheets. And that mechanism serve up the correct cached 'all' file depending on the language.
However, what if the theme served its CSS before the 'all' sheet with the custom CSS from the settings? Could this be a way? i.e before '$OUTPUT->standard_head_html()' in the layout files. The downside of this is the need to separate any '$THEME->csspostprocess' type things with no language specific CSS as you don't want to create your own cache mechanism. You just want to serve up pre-compiled files in the styles folder.
Thoughts? Contributed theme prototype or should core really optimise this mechanism?
Cheers,
Gareth