Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The garden rules returned from Girouette need to be sorted #8

Open
green-coder opened this issue Jul 25, 2021 · 4 comments
Open

The garden rules returned from Girouette need to be sorted #8

green-coder opened this issue Jul 25, 2021 · 4 comments

Comments

@green-coder
Copy link

green-coder commented Jul 25, 2021

In Girouette v0.0.4, the garden rules returned by class-name->garden have some metadata which need to be used when deciding the order in which those rules need to be output in a CSS file.

This is how the processor tool of Girouette is accessing the ordering data and how it sort the rules:
https://github.com/green-coder/girouette/blob/v0.0.4/lib/processor/src/girouette/processor.clj#L172-L173

A similar sorting needs to be done in Ornament, to avoid the issue raised in green-coder/girouette#66

Update: see my comment below.

@green-coder
Copy link
Author

In a recent commit, I added a comparator in Girouette which is supposed to be used to compare the garden rules from its output, to determine the order in which the rules should appear in the CSS file.

This is to be used in place of what I recommended in my comment above. I will make a new release later tonight.

@plexus
Copy link
Member

plexus commented Sep 7, 2021

@green-coder how do you recommend we sort this when we have a mix of styles coming from girouette and plain garden styles?

@green-coder
Copy link
Author

I don't know what to recommend, I don't know if you have any constraint on the ordering on the rules which do not come from Girouette.

The comparator in Girouette is currently using 2 criteria for the ordering:

  • one based on a number in the metadata
  • one based on if a rule is media query - the media queries are placed after the non media queries.

@green-coder
Copy link
Author

Girouette v0.0.5 is released, by the way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants