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 a String earlier in the pipeline, at the point we resolve the title.
Uses hex_color for that concern as it's simple and looks to do the job well.
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.