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

Sort prefixed values before unprefixed values with the same key #211

Merged
merged 1 commit into from
Mar 8, 2017

Conversation

xymostech
Copy link
Contributor

Summary: In #200 the way we started sorting prefixed and unprefixed values
differently. This builds on that by making sure that when style values are
prefixed, they come before the unprefixed values with the same key.

E.g.

display: -webkit-flex; // prefixed value comes before
display: flex;         // unprefixed value

@lencioni

const prefixedDeclarations = prefixAll(handledDeclarations.elements);

const prefixedRules = flatten(
objectToPairs(prefixedDeclarations).map(([key, value]) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated: I wonder if we should replace objectToPairs with Object.entries

src/generate.js Outdated
const aOrder = sortOrder.hasOwnProperty(a[0]) ? sortOrder[a[0]] : -1;
const bOrder = sortOrder.hasOwnProperty(b[0]) ? sortOrder[b[0]] : -1;
return aOrder - bOrder;
return sortOrderForProperty(a) - sortOrderForProperty(b);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this could be simplified to use the implicit return style

Summary: In #200 the way we started sorting prefixed and unprefixed values
differently. This builds on that by making sure that when style values are
prefixed, they come before the unprefixed values with the same key.

E.g.

```css
display: -webkit-flex; // prefixed value comes before
display: flex;         // unprefixed value
```

@lencioni
@xymostech xymostech force-pushed the sort-prefixed-values branch from 57c70ce to d8a629b Compare March 8, 2017 23:10
@xymostech xymostech merged commit 95feeec into master Mar 8, 2017
@xymostech xymostech deleted the sort-prefixed-values branch March 8, 2017 23:13
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

Successfully merging this pull request may close these issues.

2 participants