1.0.6 • Published 5 months ago

bem-modules v1.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

bem-modules

BEM classname transformer for CSS modules.

Quick Start

To get started, you need to install the package:

npm install bem-modules --save-dev

And use it in your components:

/* components/Card/Card.module.sass */

.card {
    color: white;
    background-color: blue;

    &--variant {
        &-red {
            background-color: red;
        }
    }

    &__title {
        color: green;
        font-size: 1.5rem;

        &--small {
            font-size: 1rem;
        }
    }
}
// components/Card/Card.tsx

import { transformer } from "bem-modules";

import styles from "./Card.module.sass";

const bem = transformer(styles);

export const Card = () => {
    return (
        <div className={bem({ variant: "red" })}>
            <div className={bem("title")}>Card Title</div>
            <div className={bem("title", { small: true })}>Small Card Title</div>
        </div>
    );
};
1.0.6

5 months ago

1.0.5

5 months ago

1.0.4

5 months ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago