Nutritious Polygonal Meatball

    cx.macro
    TypeScript icon, indicating that this package has built-in type declarations

    0.1.1 • Public • Published

    cx.macro

    Why?

    When applying class names conditionally to dom elements or components, I found it quite tedious to always write code that looks like this ["c1", cond && "c2"].filter(Boolean).join(" "). So I created a macro that helps reducing the boilerplate at compile time.

    What?

    turns

    import cx from "cx.macro";
     
    <div className={cx("c1", cond && "c2", variants[val])} />;

    into

    <div className={["c1", cond && "c2", variants[val]].filter(Boolean).join(" ")} />

    Keywords

    none

    Install

    npm i cx.macro

    DownloadsWeekly Downloads

    0

    Version

    0.1.1

    License

    ISC

    Unpacked Size

    1.64 kB

    Total Files

    4

    Last publish

    Collaborators

    • danielberndt