Redesign content rule to support all possible values#180
Redesign content rule to support all possible values#180giraud merged 8 commits intogiraud:masterfrom
Conversation
3c287a8 to
82694e1
Compare
|
Sorry, I had little time recently to work on bs-css. I'll review that pr in the next days |
There was - unfortunately - already a content alias in the global namespace. contentRule was used to introduce that rule and not break existing code. |
82694e1 to
903496a
Compare
Alright, that makes sense. I can see there is an alias for a polymorphic variant. 👍 |
| ); | ||
|
|
||
| let contentRule = x => D("content", {j|"$x"|j}); | ||
| let contentRule = x => D("content", string_of_content(x)); |
There was a problem hiding this comment.
if possible, I'd like to inline the string_of_content
There was a problem hiding this comment.
This way there will be duplication as I use the function in contentRules as well. What do you propose then?
There was a problem hiding this comment.
Maybe I could put these functions (together with string_of_counter_*) into modules inside AtomicTypes? I can see you're avoiding this so far (like string_of_background), what was the reason of that?
There was a problem hiding this comment.
just string_of_content. Css.re is already huge, I'm trying to not add useless code. In that case, creating a function doensn't add anything. For operations, it's needed because it's used in multiple locations
There was a problem hiding this comment.
string_of_content is used twice as well. Am I missing something?
|
Thank you so much for such a detailed comments, @giraud! |
|
Thank you |
|
@giraud Hey! When can I expect a new version in NPM registry? :) |
It's, unfortunately, a breaking change. To support values other than strings, I had to introduce variant type, so existing rules need to be migrated like this:
Do you think that's okay? Can we afford another major version in such a short time? Maybe there is another way to model this?
If we eventually agree to break the API, does it make sense to rename
contentRuletocontent? (andcontentRulestocontentsI suppose). I was quite surprised thatcontentfunction is not available, but I assume there was a good reason for this name. What was that?Plus, I've added support for
counter-*rules and matching functions.