
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
babel-plugin-transform-import-css
Advanced tools
Injects imported styles (css-modules) into js
Injects class map imported from css-modules into js.
Plugin respects webpack css-modules API and postcss config.
npm add -SD babel-plugin-transform-import-css
.babelrc example:
{
"sourceMaps": "inline",
"presets": [
"@babel/env",
"react"
],
"plugins": [
["transform-import-css", {
"generateScopedName": "lib-[name]-[local]-[hash:base64:4]"
}]
]
}
Every js file that has a statement such as:
import classes from './Component.css'
// ... some code
will be transpiled to:
var classes = {
root: 'lib-foo-root-SFs0',
// ... some classes ...
}
require('load-styles')('.root{color:red}; ...some css...') // puts styles into the head
// ... some code
generateScopedName
— css-modules scope template. Default: [name]__[local]___[hash:base64:5]
configPath
— postcss config path. Default: auto detectext
— postcss files' extension. Typical use: ext: '.pcss'
. Default: '.css'
Note. Plugin rely on some @babel/ peerDependencies, that are typically included in your project by @babel/core self.
Bundling the css with npm packed library of js/react components. It is good for portability.
configPath
and ext
optionsrequire('load-styles')(css)
inserting in that cases.postcss-load-config
lib can't be used due to synchronous nature of the babel).export { classes }
friendlyimport jssObject from './style.css'
)Russian Fintech startup
FAQs
Injects imported styles (css-modules) into js
The npm package babel-plugin-transform-import-css receives a total of 613 weekly downloads. As such, babel-plugin-transform-import-css popularity was classified as not popular.
We found that babel-plugin-transform-import-css 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
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.