postcss / sugarss

Indent-based CSS syntax for PostCSS
MIT License
707 stars 39 forks source link

Nested properties #28

Closed nicolasparada closed 8 years ago

nicolasparada commented 8 years ago

In Sass you have nested properties so you can write:

body
  font:
    family: sans-serif
    size: 16px
    weight: 300

and get:

body {
  font-family: sans-serif;
  font-size: 16px;
  font-weight: 300;
}

I miss this on sugarss.

ai commented 8 years ago

Short answer: https://github.com/jedmao/postcss-nested-props

Full answer: SugarSS is just a alternate way to write a CSS. All features like nested rules or nested properties should be implemented in plugins. So we will have all benefits of modularity.

nicolasparada commented 8 years ago

Nice. Thank for you help @ai :)

nicolasparada commented 8 years ago

I'm having other problem. After I added postcss-nested-props, it only parses some nested properties. I mean:

body
  font:
    family: sans-serif
    size: 16px
    weight: 300

becomes:

body {
  font-family: sans-serif;
  font-size: 16px;
  weight: 300;
}
ai commented 8 years ago

Could you disable this plugin and show me input/ouput?

ai commented 8 years ago

But I will look tomorrow. Nite it is time to sleep 🙈

nicolasparada commented 8 years ago

Following the same example. it turns into:

body {
  font {
    family: sans-serif;
    size: 16px;
    weight: 300 {}
  }
}
nicolasparada commented 8 years ago

Another case:

.test
  font:
    family: sans-serif
    size: 16px
    weight: 300
  margin:
    top: 0
    right: 0
    bottom: 0
    left: 0

Fails on font-weight.

.test
  margin:
    top: 0
    right: 0
    bottom: 0
    left: 0
  font:
    family: sans-serif
    size: 16px
    weight: 300

Fails on margin-left.

ai commented 8 years ago

Sorry, I miss what example fails. Could you find minimum file example to reproduce issue and show me input and output.

ai commented 8 years ago

Fixed 4e4aca1

ai commented 8 years ago

Also ee97d55

ai commented 8 years ago

Released in 0.1.4

nicolasparada commented 8 years ago

Thanks @ai good work ;) All working fine now.