
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
babel-plugin-transform-jsx-css-modules
Advanced tools
Transform className attributes in JSX to reference CSS Modules
Transforms className
attributes in JSX to get css-modules' references.
Note: It does not turn on CSS Modules in your project, it assumes that you made it yourself (via webpack and css-loader for example).
import './styles.css'
const Component = () => (
<div styleName="root">
<h1 className="paragraph">Hello World</h1>
<p className="global" styleName="local">I'm an example!</p>
</div>
)
Will be transpiled into
import __CSSM__ from './styles.css'
const Component = () => (
<div className={__CSSM__['root']}>
<h1 className="paragraph">Hello World</h1>
<p className={["global", __CSSM__["local"]].join(" ")}>I'm an example!</p>
</div>
)
Install plugin
npm install --save-dev babel-plugin-transform-jsx-css-modules
Add plugin to your .babelrc
file
{
"plugins": [
"transform-jsx-css-modules"
]
}
Name | Type | Default | Description |
---|---|---|---|
pathToStyles | RegExp | /^\.\/styles\.css$/ | It specifies what imports should be transformed Note: Escape symbols if you specify it as a string |
pathToStyles
If you set it to /^\.\/module\.scss$/
it will handle imports which start and end with ./module.scss
:
{
"plugins": [
["transform-jsx-css-modules", {
"pathToStyles": "^\\.\\/module\\.scss$"
}]
]
}
import './module.scss'
Will be transformed into:
import __CSSM__ from './module.scss'
FAQs
Transform className attributes in JSX to reference CSS Modules
The npm package babel-plugin-transform-jsx-css-modules receives a total of 7 weekly downloads. As such, babel-plugin-transform-jsx-css-modules popularity was classified as not popular.
We found that babel-plugin-transform-jsx-css-modules 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
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.