Skip to content

Instantly share code, notes, and snippets.

@RafalFilipek
Created September 5, 2017 07:00
Show Gist options
  • Save RafalFilipek/f6dd45f2eaf7581a0b7435151cbe496f to your computer and use it in GitHub Desktop.
Save RafalFilipek/f6dd45f2eaf7581a0b7435151cbe496f to your computer and use it in GitHub Desktop.

In this example I have two base classes foo and bar.

const foo = css`
  color: red;
`;

const bar = css`
color: blue;
`;

Now lets create two additional calsses boz and biz

const boz = css`
  ${foo};
  ${bar};
  padding: 1rem;
`;

const biz = css`
  composes: ${foo} ${bar};
  padding: 1rem;
`;

This will generate

.css-1gao8uk{color:red;}
.css-bithoy{color:blue;}
.css-2xaek2{color:blue;padding:1rem;}

So why do I need composes property? :) I was trying many combinations but no luck :/

Wait ... According to this issue I don't need composes property at all, right?

Thank you!

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