newridetech / octobercms-classnames
Classnames plugin for October CMS
Installs: 9
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 4
Forks: 0
Open Issues: 0
Type:october-plugin
Requires
- php: >=7.0
- composer/installers: ~1.0
- newridetech/php-classnames: ^1.0.1
This package is not auto-updated.
Last update: 2024-10-27 06:13:14 UTC
README
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
Instead of:
<nav class="link {{ item.isActive ? 'link--active' : '' }} {{ item.extra == 'primary' ? 'link--primary' : '' }}"> .... </nav>
Use:
<nav class="{{ classnames('link', { 'link--active': item.isActive, 'link--primary': item.extra == 'primary' }) }}" > .... </nav>
And that's all. :) I hope it helps.