refactor(@roots/bud-build) build.rules api #891
Merged
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.
Type of change
Dependencies added
Details
Modifying rules is kind of a pain. This makes it a lot easier to set up a rule without needing to import the
Rule
constructor, etc.old:
new:
or, treat it like a factory (don't set it)
and/or do some funky chaining:
Lastly, in order to interact with a rule you'd need to manually pass the bud instance to any of the getters, which was weird:
No longer as weird:
I think this will become a bigger deal as more people want to do stuff like import assets from
node_modules
or other things bud doesn't support out-of-the-box because of the performance implications. @QWp6t had the idea of making that a facade-level function and this is the first step towards that, I think.