Radical Design Course by Jack McDade

From the creator of Statamic

Learn how to make your websites standout and be remembered.

Bought Jack McDade's course on design. Going through it now...and it is SO well done!

— Justin Jackson, Transistor.fm

compact Modifier

Converts a comma-delimited list of variable names into an array that can be used anywhere. Arrays are accepted.

It allows colon delimited syntax to target nested variables.

title: 'The finest title there ever was'
one: 'Value One'
two: 'Value Two'
{{ "stuff:one, title, stuff:two" | compact | ul }}

Would produce the following output:

<li>Value One</li>
<li>The finest title there ever was</li>
<li>Value Two</li>
Hot Tip!

It's similar to PHP's compact() function.

$foo = 'bar';
$baz = 'qux';
compact('foo', 'baz'); // ['bar', 'qux']

Docs feedback

Submit improvements, related content, or suggestions through Github.

Betterify this page →