This plugin provides a developer tool to generate complex CSS classnames in Twig templates in a way that makes them more readable.
It's a port of https://github.com/JedWatson/classnames but for PHP.
If you want a pure PHP version without plugin, please try: https://github.com/newridetech/php-classnames.
See the Documentation tab for details.
Try other
For more developer tools from the same author, please check:
Instead of:
<nav class="links {{ item.isActive ? 'links--active' : '' }} {{ item.type == 'primary' ? 'links--primary' : '' }} {{ item.extraClasses }}"> .... </nav>
Use:
<nav class="{{ classnames('links', item.extraClasses, { 'links--active': item.isActive, 'links--primary': item.type == 'primary' }) }}" > .... </nav>
And that's all. :) I hope it helps.
Plugin icon obtained from: https://www.freepik.com/free-icon/css-file-format-with-brackets_742124.htm#term=css&page=1&position=9
-
This plugin has not been reviewed yet.
-
1.0.3 |
Update plugin composer dependencies Sep 27, 2018 |
---|---|
1.0.2 |
Bundle vendor libraries May 07, 2018 |
1.0.1 |
First version of Classnames Apr 25, 2018 |