DEV Community

FSCSS tutorial for FSCSS tutorial

Posted on

✨ FSCSS Quick Tip — Using Arrays the Smart Way

FSCSS gives CSS superpowers, and one of my favorite features is how it handles arrays.
They make your styles more organized, reusable, and cleaner — without needing JavaScript.

Today, here’s a very short example showing two ways to create arrays in FSCSS.


🥇 1. Using the $array Variable

You can declare an array using variables and then convert it into an FSCSS array:

$array: a[2,3,4];

@arr($array!)
exec(_log, "@arr.a")  /* 2 3 4 */
Enter fullscreen mode Exit fullscreen mode

@arr() registers the array, and exec(_log, ...) prints it to the console.
Simple and fast.


🥈 2. Using str() for Large Multi-Line Arrays

If you want to store a large amount of text, this method is cleaner and easier:

str(Array, "b[
A,
B,
C
]")

@arr(Array)

exec(_log, "@arr.b") /* A B C */
Enter fullscreen mode Exit fullscreen mode

Using str() lets you define big arrays over multiple lines — perfect for:

  • Long lists

  • Text blocks

  • Component variants

  • Lookup tables

And FSCSS will still treat it as a proper array.


FSCSS arrays are simple but powerful.
Whether you’re storing numbers, text, or multi-line values, the syntax stays clean and readable.


How to use FSCSS

Top comments (0)