postcss / postcss-custom-properties

Use Custom Properties in CSS
https://postcss.github.io/postcss-custom-properties
MIT License
596 stars 77 forks source link

Merging custom property "blocks" #34

Closed welly closed 9 years ago

welly commented 9 years ago

Hello all,

Just started looking at using this module, so far, so good.

I'm also using postcss-import to merge my css files into a single CSS file. I have a number of different settings.*.css files which declare custom properties, so for example:

settings.fonts.css:

:root {
  --primary-font-family: 'Open Sans', sans-serif;
  --base-font-size: 16px;
}

settings.layout.css:

:root {
  --document-width: 960px
}

etc. Ignore the content, just an example.

When I run my gulp task, I get an output basically like:

:root {
  --primary-font-family: 'Open Sans', sans-serif;
  --base-font-size: 16px;
}
:root {
  --document-width: 960px
}

...rest of CSS here...

I'm not sure if it's the place of this module or another one to concatenate those property declarations to something like:

:root {
  --primary-font-family: 'Open Sans', sans-serif;
  --base-font-size: 16px;
  --document-width: 960px
}

Any help/advice on this would be appreciated!

cheers

MoOx commented 9 years ago

This plugins (by default) should remove custom properties definitions. So I think it's not really relevant. What you are asking is more the work of a minifier.