
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.
github.com/naistran/css-in-js-loader
Use CSS in JS with postcss-js in webpack
npm i --save-dev css-in-js-loader
If you're using babel to process your Javascript then postcss-loader only transforms .js
files one level deep, i.e. it doesn't transform that file's imports.
Put css-in-js
between your CSS and JS loaders. css-in-js-loader
detects if the file is a .js
file and converts it to CSS using postcss-js so you can use your CSS loaders (e.g. postcss-loader) normally.
Example webpack configuration:
{
loaders: [
{ test: /\.css$/, loader: 'css!postcss!css-in-js!babel' },
{ test: /\.css\.js$/, loader: 'css!postcss!css-in-js!babel' },
{ test: /\.js$/, loader: 'babel' },
],
}
Now you can write CSS in JS:
import { minWidth } from './utils/media';
import { lap } from './breakpoints';
export default {
'.root': {
background: 'blue',
[minWidth(lap)]: {
background: 'red',
},
},
};
FAQs
Unknown package
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.