Re:How We Could Write Better CSS
by ahallock on Tuesday September 24, 2013 @03:02PM
(#6439989)
I had a similar experience recently when I was using many compose-able CSS styles. My solution was to use a preprocessor and make an aggregate style; for example:
<li class="u-paddingLarge t-important">
would become:
<li class="MyImportantItem">
with the SASS being:
.MyImportantItem {
@extend .u-paddingLarge;
@extend .t-important;
}
You can avoid writing inline styles, keep things DRY, and still have compose-able styles.
would become: <li class="MyImportantItem">
with the SASS being: .MyImportantItem { @extend .u-paddingLarge; @extend .t-important; }
You can avoid writing inline styles, keep things DRY, and still have compose-able styles.