Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
babel-plugin-react-cssmoduleify
Advanced tools
Babel plugin to transform traditional classNames to CSS Modules
Note: this plugin now requires Babel 6. To use the Babel 5 support ensure you continue using the pre 1.0 release.
For those who have tasted CSS Modules it is hard to imagine life without it. At Walmart we have a large number of core components that still use traditional CSS classNames and global CSS. This babel plugin is used to convert all global styles into CSS Modules to allow teams to opt-in to CSS Modules.
Previously this attempted to be rather aggressive in it’s resolving of className
calls. The current implementation is much simpler and therefore should also
support more use cases. Currently classNames
must be a string
, so we can
take any complex assignment and do the lookup on the fly.
It detects the correct className
calls in both JSX, React.createElement, and
compiled JSX output.
npm install --save babel-plugin-react-cssmoduleify
.babelrc
{
"plugins": [
["babel-plugin-react-cssmoduleify", {
// this string is applied to the current path to transform or bail out.
// This is because this plugin is often used on external code.
"path": "node_modules/regex-path-"
"cssmodule": "client/styles/base.styl"
"modules": "es6",
"log": true
}]
],
}
path
: string
: string applied as a regex to each compiled filecssmodule
: string
: path from process.cwd()
to global CSS filemodules
: "es6"|"commonjs"
the type of module system cssmodule should be required as.log
: boolean
log potentially unhandled cases. Default to false.Look at the unit tests.
This assumes that you can get all exports into one file. Most CSS Preprocessors build on the global nature of CSS and have their own internal global worlds. Importing all of your traditional files into a single file in Stylus or Sass will likely accomplish this.
Copyright (c) 2015 Walmart Labs
FAQs
Babel plugin to transform traditional classNames to CSS Modules
The npm package babel-plugin-react-cssmoduleify receives a total of 15 weekly downloads. As such, babel-plugin-react-cssmoduleify popularity was classified as not popular.
We found that babel-plugin-react-cssmoduleify 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.