Skip to content

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

Closed

Description

@kof

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}
    }
  }
`

Activity

  1. changed the title [-][template-jss] A new format which compiles to jss JSON[/-] [+][jsst] A new format which compiles to jss JSON[/+] on Apr 23, 2016
  2. kof commented on Apr 23, 2016

    @kof
    MemberAuthor
  3. added
    idea
    on Apr 23, 2016
  4. changed the title [-][jsst] A new format which compiles to jss JSON[/-] [+][csst] A new format which compiles to jss JSON[/+] on Apr 23, 2016
  5. changed the title [-][csst] A new format which compiles to jss JSON[/-] [+][jsst] A new format which compiles to jss JSON[/+] on Apr 23, 2016
  6. mr-mig commented on Apr 23, 2016

    @mr-mig

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

  7. kof commented on Apr 23, 2016

    @kof
    MemberAuthor

    Suggestions?

  8. mr-mig commented on Apr 23, 2016

    @mr-mig

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

  9. changed the title [-][jsst] A new format which compiles to jss JSON[/-] [+][jsst] A CSS string format which compiles to jss JSON[/+] on Apr 26, 2016
  10. kof commented on Nov 3, 2016

    @kof
    MemberAuthor

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

  11. DenisIzmaylov commented on Feb 18, 2017

    @DenisIzmaylov
    Contributor

    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:

  12. DenisIzmaylov commented on Feb 18, 2017

    @DenisIzmaylov
    Contributor
  13. DenisIzmaylov commented on Feb 18, 2017

    @DenisIzmaylov
    Contributor

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

  14. trusktr commented on Mar 20, 2017

    @trusktr

    Wow, preJSS looks awesome!

  15. kof commented on May 14, 2017

    @kof
    MemberAuthor

    I think we can close this and go with preJSS

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    idea

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions