postcss-topcoat-naming
A PostCSS plugin to collapse BEM @rules and corresponding Topdoc comments
Examples
/* topdocname: Buttondescription: a simple buttonmarkup: | {{#state}}<button class="{{ blockName }}"/> {{/state}}*/@ /* topdoc name: Secondary Button description: a secondary button */ @}
is collapsed to this:
/* topdocname: Buttondescription: a simple buttonmarkup: | <button class="Button"/> <button class="Button is-disabled"/>*/
and if a modifier is passed through, it is collapsed to this:
/* topdocname: Secondary Buttondescription: a secondary buttonmarkup: | <button class="Button--secondary"/> <button class="Button--secondary is-disabled"/>*/
Usage
Using it as a PostCSS plugin.
;; ;
Option
Options that can be passed to the plugin.
{modifier}
(String)
If the modifier
matches a @modifier
value, the rules will be combined.
In this example, when the modifier
value is set to secondary
:
@ } @}
The result is:
If the provided modifier
value does not match a modifier in the source css the modifier value is still appended to the class, but the rule is not actually modified.
In this example, when the modifier
value is set to tertiary
:
@ } @}
The result is:
Topdoc
Provided Topdoc comments that correspond to @Block
atRules.
States
TODO: write
Modifiers
TODO: write