Custom CSS not overridnig extension's CSS
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
## Bug Report
**Current Behavior**
https://discuss.flarum.org/d/18380-issue-custom-css-not-overridnig-extension-s-css
**Steps to Reproduce**
1) Add customCSS overrding Extension one.
2) Viola, its not overrding
**Expected Behavior**
It should
**Screenshots**
There is compiled styles file [download](https://brecska.sk/forum-5e37d504.css)

**Environment**
- Flarum version:0.8
**Possible Solution**
In `ForumServiceProvider.php` methor register () change lines from 85 to these:
```php
$assets->css(function (SourceCollector $sources) {
$sources->addStringToEnd(function () {
return $this->app->make(SettingsRepositoryInterface::class)->get('custom_less');
});
$sources->addFile(__DIR__.'/../../less/forum.less');
});
```
2) Change content Sourcecollector.php class from Frontend dir to:
```php
/**
* @var SourceInterface[]
*/
protected $sources = [];
/**
* @var SourceInterface[]
*/
protected $last = [];
/**
* @param string $file
* @return $this
*/
public function addFile(string $file)
{
$this->sources[] = new FileSource($file);
return $this;
}
/**
* @param callable $callback
* @return $this
*/
public function addString(callable $callback)
{
$this->sources[] = new StringSource($callback);
return $this;
}
/**
* @param callable $callback
* @return $this
*/
public function addStringToEnd(callable $callback)
{
$this->last[] = new StringSource($callback);
return $this;
}
/**
* @return SourceInterface[]
*/
public function getSources()
{
return array_merge($this->sources, $this->last);
}
```
Contributor guide
Research direction
Start with ForumServiceProvider.php and the SourceCollector.php changes described in the report, then inspect how forum.less and the custom_less setting contribute to the compiled styles file. Reproduce the issue on Flarum 0.8 using the linked example and compare stylesheet ordering. Done means custom CSS overrides the extension CSS as expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, php
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100