Security News
vlt Debuts New JavaScript Package Manager and Serverless Registry at NodeConf EU
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
@hishprorg/consequuntur-accusamus
Advanced tools
[![Build Status](https://travis-ci.org/gtournie/@hishprorg/consequuntur-accusamus.svg?branch=master)](https://travis-ci.org/gtournie/@hishprorg/consequuntur-accusamus) [![Coverage Status](https://coveralls.io/repos/github/gtournie/@hishprorg/consequuntur-
className and styleName on steroids 💪
Allow you to write jsx classNames in a simpler way, without having to worry about importing a helper (like clsx or classnames). className
or styleName
attributes take any number of arguments which can be a string, an array or an object (if the value associated with a given key is falsy, that key won't be included in the output). See examples
When @hishprorg/consequuntur-accusamus cannot resolve className
/ styleName
during compilation, it imports a helper function (read build time resolution). Therefore, you must install babel-plugin-react-css-modules as a direct dependency of the project.
$ npm install @hishprorg/consequuntur-accusamus --save
{
plugins: [
['transform-jsx-classnames', {
// default options
dedupe: false,
attributes: ['className', 'styleName']
}]
]
}
Note: ⚠️ If you're using
babel-plugin-react-css-modules
, ensure you're addingtransform-jsx-classnames
before
The plugin will try to resolve the className
/ styleName
during the compilation (className={"foo", { active: true }}
) and fallback to runtime if not possible (className={_cx("bar", { disabled: props.disabled })}
- a tiny helper (256B minified) will be included automatically.
The runtime helper is similar to the clsx package. See examples.
Dedupe behaves like the classname dedupe version. Way faster though. Its speed is similar to classnames
in no dedupe version.
The only difference you'll find will be with full numeric classNames: output will always spit numbers first (ex: className={"a", 12}
=> className="12 a"
). It shouldn't be a big deal though, as using numeric values for classNames is pretty rare and order only matters in a very few specific cases.
See benchmark dir.
<div className={"foo", "bar"}>
→ <div className="foo bar"></div>
<div className={'foo', { bar: true }}>
→ <div className="foo bar"></div>
<div className={{ 'foo-bar': true }}>
→ <div className="foo-bar"></div>
<div className={{ 'foo-bar': false }}>
→ <div className=""></div>
<div className={{ foo: true }, { bar: true }, ["foobar", "duck"]}>
→ <div className="foo bar foobar duck"></div>
<div className={'foo', { bar: true, duck: false }, 'baz', { quux: true }}>
→ <div className="foo bar baz quux"></div>
<!-- styleName -->
<div styleName={"foo", "bar"}>
→ <div styleName="foo bar"></div>
<!-- Dedupe -->
<div className={'foo foo', 'bar', { bar: true, foo: false }}>
→ <div className="bar"></div>
<!-- No change -->
<div className={props.active ? "foo" : "bar"}>
→ <div className={props.active ? "foo" : "bar"}></div>
When className
/ styleName
can't be resolved at compilation.
<div className={"foo", { active: props.active }}>
→ <div className={_cx("foo", { active: props.active })}></div>
<div className={{ foo: true, [`btn-${props.type}`]: true }}>
→ <div className={_cx({ foo: true, [`btn-${props.type}`]: true })}></div>
<div className={"foo", props.active && getClassName()}>
→ <div className={_cx("foo", props.active && getClassName())}></div>
You like this package?
FAQs
security holding package
The npm package @hishprorg/consequuntur-accusamus receives a total of 1 weekly downloads. As such, @hishprorg/consequuntur-accusamus popularity was classified as not popular.
We found that @hishprorg/consequuntur-accusamus demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
Security News
Research
The Socket Research Team uncovered a malicious Python package typosquatting the popular 'fabric' SSH library, silently exfiltrating AWS credentials from unsuspecting developers.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.