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

Minify style strings #313

Open
brandonkal opened this issue May 7, 2019 · 2 comments
Open

Minify style strings #313

brandonkal opened this issue May 7, 2019 · 2 comments

Comments

@brandonkal
Copy link

This would appear to be an easy win to save some bytes.
Colors and other style strings can be made smaller in the final bundle:

const HoverRow = styled(StyledRow, {
  ':hover': {
    backgroundColor: 'rgb(229,       229,           229)',
  },
})

Becomes:

const HoverRow = styled(StyledRow, {
  ':hover': {
    backgroundColor: '#e5e5e5',
  },
})

Even lowercasing and shorthand whenever possible:
"#FFFFFF" -> "#fff"

@tajo
Copy link
Member

tajo commented May 23, 2019

Yea, this would be a nice addition since styletron is performance oriented. Assuming it would not add too much to the styletron's bundle size.

@re-thc
Copy link

re-thc commented Jan 11, 2020

0px can be set to 0. There's likely a whole set of rules that can be applied.

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

No branches or pull requests

4 participants