souporserious/restyle

Support for template literals syntax?

2Pacalypse- opened this issue · 2 comments

Hey man, pretty cool library!

Just one question, would it be possible to support template literals syntax of writing CSS, instead of the object syntax?

For example, using the CSS Prop example from the homepage, it would be nice to write something like this:

export default function CSSProp() {
  return (
    <div
      css={`
        padding: 1rem;
        background-color: peachpuff;
      `}
    >
      Hello World
    </div>
  );
}

Thank you! In favor of keeping the library focused and small I'm not interested in supporting template literals at this time.

Just for general knowledge, you can achieve this with a babel plugin:

https://www.npmjs.com/package/babel-plugin-transform-css-tagged-template-to-object

So you lift the responsibility away from this library. It may be a good trade off if you prefer template literals.