Hello Flarum Team 👋🏻
I would like to propose a very edge-case addition to Flarum.
I would make a PR that adds an extender that would help me to achieve something that I don't see any other way of achieving: I need to edit the raw CSS that the Less compiler creates.
I locally tested by inserting my code at this line : https://github.com/flarum/framework/blob/518b39610e1eb40a2fd3be2a452d50b55c9b953e/framework/core/src/Frontend/Compiler/RevisionCompiler.php#L138 and that worked great.
So what I would propose is to write a small extender that registers callbacks that would be called at that specific line, getting $this
, $content
, $file
and $sources
as arguments.
Would such a PR be accepted ? I know this is really an edge-case, but I really don't know how else to achieve my desired outcome. And I don't think this addition would break anything or impact performance.
Finally a bit of background on what I'm trying to do:
- Create a new Flarum Frontend that has different CSS than
forum
- the CSS is different in a sense that it is all scoped to a special
id
- this makes it possible to integrate this CSS into an existing webpage without clashing with it.
➡️ Challenge that would be solved by this proposal: Make CSS variables work as expected.
I currently do something like
#gb-integrable-flarum-container {
@import '../../../vendor/flarum/core/less/forum.less';
}
The compiled output of this contains #gb-integrable-flarum-container :root
and should be #gb-integrable-flarum-container:root
(without the whitespace) to work properly. So the only option I currently was able to think of is changing the CSS output of the compiler.
Maybe someone can think of a better way to achieve all of this, with an approach that would not involve the need of making changes to flarum/core
, in thath case I will welcome any ideas with joy!