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.
Closes #99
Replaces #157
cc: @Sky9x as you've already thought a lot about this - I used a bunch of code and ideas from your branch, it was really helpful!
As I already wrote the doc page, I think this summarises the changes quite nicely:
The approach I took here was to write some slightly hacky Rust code to produce the small subset of CSS we need for each new variant. There's a unit test that will fail if either the Rust or SCSS code get out of step.
I think this is a good compromise between still doing the majority of complex CSS with SCSS, having runtime directive safety in Rust, and ensuring that there are some checks in place. An alternative would just have been to work out how to run an SCSS compiler inside a Rust binary, but I really did not want to do that.
This approach is also back compatible, and opt in for new users, which is great.
Internals wise, this changes slightly how the
Directive
type works internally. Basically, we standardise to aString
earlier in the pipeline, at the point we resolve thetitle
.Uses
hex_color
for that concern as it's simple and looks to do the job well.