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

[jsst] A CSS string format which compiles to jss JSON #220

Closed
kof opened this issue Apr 23, 2016 · 11 comments
Closed

[jsst] A CSS string format which compiles to jss JSON #220

kof opened this issue Apr 23, 2016 · 11 comments
Labels
idea What if we turn JSS into styled-components?

Comments

@kof
Copy link
Member

kof commented Apr 23, 2016

Using tagged template literals, we can create a css like syntax which easily compiles down to jss json.

export default css`
  datalist {
    background: ${white};
    border: 1px solid ${gainsboroLight};
    box-shadow: 0px 3px 4px 0 ${grapeTypoSemi};
    overflow: auto
  }
  item {
    extend: ${[fonts.normal, mixins.ellipsis]};
    padding: 5px 7px;
    color: ${grey};
    cursor: ${pointer};
  }
  @media (min-width: 1024px) {
    item {
      color: ${blue}
    }
  }
`
@kof kof changed the title [template-jss] A new format which compiles to jss JSON [jsst] A new format which compiles to jss JSON Apr 23, 2016
@kof
Copy link
Member Author

kof commented Apr 23, 2016

cc @mr-mig @maximkoretskiy @tyv

@kof kof added task idea What if we turn JSS into styled-components? labels Apr 23, 2016
@kof kof changed the title [jsst] A new format which compiles to jss JSON [csst] A new format which compiles to jss JSON Apr 23, 2016
@kof kof changed the title [csst] A new format which compiles to jss JSON [jsst] A new format which compiles to jss JSON Apr 23, 2016
@mr-mig
Copy link

mr-mig commented Apr 23, 2016

Sehr gut!
But I am a bit embarrassed by this one: extend: ${[fonts.normal, mixins.ellipsis]};

@kof
Copy link
Member Author

kof commented Apr 23, 2016

Suggestions?

@mr-mig
Copy link

mr-mig commented Apr 23, 2016

@kof seems quite logical, tbh. Just a matter of personal preference.
It should be like that anyway - a reference to JS objects.

@kof kof changed the title [jsst] A new format which compiles to jss JSON [jsst] A CSS string format which compiles to jss JSON Apr 26, 2016
@kof
Copy link
Member Author

kof commented Nov 3, 2016

We should take an example from styled-components, but preprocess those tagged literals serverside and convert to jss json.

@DenisIzmaylov
Copy link
Contributor

DenisIzmaylov commented Feb 18, 2017

It could be implemented as:

import fromCSS, { keyframes } from 'jss-from-css'

const rotate360 = keyframes`
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
`

const styles = fromCSS`
  button {
    color: palevioletred;
    display: block;
    margin: 0.5em 0;
    font-family: Helvetica, Arial, sans-serif;

    &:hover {
      text-decoration: underline;
      animation: ${rotate360} 2s linear infinite;
    }
  }
`

Also then push this package to language-babel plugin for syntax highlight in Atom:

@DenisIzmaylov
Copy link
Contributor

DenisIzmaylov commented Feb 18, 2017

Also we have to keep in mind this thread: https://github.com/geelen/css-components-demo

@DenisIzmaylov
Copy link
Contributor

DenisIzmaylov commented Feb 18, 2017

I'm not sure if it's OK, but if yes - we could implement it in this way:

@trusktr
Copy link

trusktr commented Mar 20, 2017

Wow, preJSS looks awesome!

@kof
Copy link
Member Author

kof commented May 14, 2017

I think we can close this and go with preJSS

@kof kof closed this as completed May 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idea What if we turn JSS into styled-components?
Projects
None yet
Development

No branches or pull requests

4 participants