feat: split frontend asset generation into separate steps for more extensibility #3446
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes proposed in this pull request:
This PR splits out the logic within frontend asset generation into separate protected methods on the class to allow for more simple extending of asset generation.
For example, this is particularly useful for FoF Nightmode. Instead of completely duplicating logic found in this class, it can now override methods in order to add its own CSS compiler, and will no longer need to manually force commit assets.
It also means that future changes to core are less likely to impact extensions hooking into this class (which caused FriendsOfFlarum/nightmode#60, for example).
You can see the impact this has in this diff: https://github.com/FriendsOfFlarum/nightmode/compare/72a75dec1ed85be8a3ec0c0442a87a6688157e84..dw/flarum-1.4-rewrite
Reviewers should focus on:
I'm not totally familiar with this area of core, so am unsure if this will have additional unforeseen (by me) impacts. Local testing with the Nightmode branch above does not raise any issues for me.
Necessity
Confirmed
Frontend changes: tested on a local Flarum installation.composer test
).