
Security News
Open Source CAI Framework Handles Pen Testing Tasks up to 3,600× Faster Than Humans
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
map-to-css-modules
Advanced tools
map-to-css-modules provide flexibility to swap class on react libed components
map-to-css-modules is a function that is used for preparing React component distributed as a npm package to keep the ability to remove an already set className.
Master
Dev
You should use it when you are providing react-component and want to keep the flexibility to detach css classes at any moment.
## Installation
We recommend to keep it in dependency using --save
npm install map-to-css-modules --save
## Usage
Take this react class as an example:
import React from 'react';
import PropTypes from 'prop-types';
import mapToCssModules from 'map-to-css-modules';
class Example extends React.Component {
static propTypes = {
cssModule: PropTypes.object,
}
render() {
const {
className,
cssModule,
tag: Tag,
...attributes
} = this.props;
return (
<Tag
className={mapToCssModules(cn('w-100', className, {
focus,
active,
disabled,
[`text-${color}`]: color,
}), cssModule)}
{...attributes}
/>
);
}
}
For example, you can see there is a css class w-100
attached to this component. It is now possible to disable or replace the class name.
<Example tag="div" cssModule={{ 'w-100': 'w-75' }} />
⚠️ When using this plugin, you must import in the first line of your application javascript entry file babel-polyfill
: ⚠️
import "babel-polyfill";
To enable ES features in older browsers, you MUST include in the package.json
"browserslist": ["ie >= 9", "last 2 versions"]
// or
"browserslist": ["ie >= 10", "last 2 versions"]
FAQs
map-to-css-modules provide flexibility to swap class on react libed components
The npm package map-to-css-modules receives a total of 705 weekly downloads. As such, map-to-css-modules popularity was classified as not popular.
We found that map-to-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
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.