Corviz / crow

Yet another template engine for PHP
https://corviz.github.io/crow/
MIT License
6 stars 2 forks source link

Advise: non-conditional @class spreading feature #8

Closed nael94 closed 3 months ago

nael94 commented 3 months ago

Currently, spreading classes is only in a conditional statement, like this:

<div @class(['class1' => true, 'class2' => false, 'class3' => true])>
  This is a div
</div>

I'd like to suggest a condition-less spreading classes array like this:

<div @class(['c1', 'c2', 'c3'])>
  This is a div
</div>

This will spread all of classes,

nael94 commented 3 months ago

Solved this with an ability to set static and conditional classes, in this example:

<div @class(['class1' => true, 'class2' => false, 'class3' => true, 'class4', 'class5', 'class6'])>
  This is a div
</div>

All non-conditional classes will be set as well:

<div class="class1 class3 class4 class5 class6">
  This is a div
</div>

This is better to represent all classes cases in one line.