
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
babel-plugin-inline-classnames
Advanced tools
Babel plugin which inlines the result of classnames
Useful for production builds.
npm:
npm install -S babel-plugin-inline-classnames
yarn:
yarn add babel-plugin-inline-classnames
Add this plugin to your Babel config. Most commonly used in .babelrc:
For all environments:
{
"plugins": ["babel-plugin-inline-classnames"]
}
For production only (see env option):
{
"env": {
"production": {
"plugins": ["babel-plugin-inline-classnames"]
}
}
}
Input:
import classNames from 'classnames';
import styles from './styles.css';
classNames('foo', 'bar');
classNames('foo', { bar: true });
classNames({ 'foo-bar': true });
classNames({ 'foo-bar': false });
classNames({ foo: true }, { bar: true });
classNames({ foo: true, bar: true });
classNames('foo', { bar: true, duck: false }, 'baz', { quux: true });
classNames(null, false, 'bar', undefined, 0, 1, { baz: null }, '');
classNames(styles.foo, styles.bar);
Output:
import styles from './styles.css';
'foo bar';
'foo bar';
'foo-bar';
'';
'foo bar';
'foo bar';
'foo bar baz quux';
'bar ' + 1;
(styles.foo || '') + ' ' + (styles.bar || '');
With bind:
import classNames from 'classnames/bind';
import styles from './styles.css';
const cx = classNames.bind(styles);
cx('foo', 'bar');
Output:
import styles from './styles.css';
(styles.foo || '') + ' ' + (styles.bar || '');
See full changelog for details.
1.* - requires Babel 6.*2.* - requires Babel 7.*FAQs
Babel plugin which inlines the result of classnames
The npm package babel-plugin-inline-classnames receives a total of 1,141 weekly downloads. As such, babel-plugin-inline-classnames popularity was classified as popular.
We found that babel-plugin-inline-classnames demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.