overclass
TypeScript icon, indicating that this package has built-in type declarations

1.0.14 • Public • Published

overclass

Manipulate classNames based on css/scss modules using tagged template strings or simple build directly classNames attribute easily

Use: mySCSSFile.scss

.tracer {
    color: blue;
}
.tracer__nano {
    color: silver;
}

.bastion {
    content: 'robot';
}
.bastion__turret {
    background-color: orange;
}

.hanzo {
    content: '-> -> ->';

    &__arrow-hold {
        content: '------ --- -- ->';
    }
}

.genji {
    color: green;

    &__ultimate {
        display: none;
    }
}

myJavascriptFile.js

import oc, { cn, jn } from 'overclass';

import styles from './mySCSSFile.scss';

<div className={oc(styles)`tracer tracer__nano`} />
<div className={oc(styles)`bastion ${turret && 'bastion__turret'}`} />

const s76 = oc(styles);
<div className={s76`hanzo ${hasTank && 'hanzo__arrow-hold'}`} />
<div className={s76`genji ${hasTank && 'genji__ultimate'}`} />

/* for classnames */
<div className={cn`bastion ${turret && 'bastion__turret'}`} />

/* for joined */
<div className={jn('bastion', turret && 'bastion__turret')} />

Readme

Keywords

Package Sidebar

Install

npm i overclass

Weekly Downloads

8

Version

1.0.14

License

MIT

Unpacked Size

11.3 kB

Total Files

13

Last publish

Collaborators

  • thismarcoantonio
  • rntgspr