
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.
css-customs-loader
Advanced tools
Exposes custom properties, custom media queries and custom selectors to JavaScript
A webpack loader that exposes CSS customs to JavaScript.
yarn add css-customs-loader postcss-loader postcss-preset-env
You need to add css-customs-loader before css-loader:
// webpack.config.js
module.exports = {
// ...
module: {
rules: [
{
test: /\.css$/,
use: [
'style-loader',
{
loader: 'css-customs-loader'
// defaults
options: {
onlyLocals: false,
},
},
'css-loader?importLoaders=1',
'postcss-loader',
],
},
],
},
}
css-customs-loader detects any valid PostCSS configuration (including options passed to postcss-loader!), so let's create one. importFrom
will point to a global.css
file containing our customs and, for the sake of this example, we'll enable all features related to CSS customs:
// postcss.config.js
module.exports = {
plugins: {
'postcss-preset-env': {
importFrom: 'src/global.css',
features: {
'custom-properties': true, // already enabled by default
'custom-media-queries': true,
'custom-selectors': true,
},
},
},
}
onlyLocals
This option should be enabled in situations like pre-rendering. You should combine it with onlyLocals
option in css-loader v2 or css-loader/locals
loader in css-loader v1. (Don't use style-loader when pre-rendering.)
See usage instructions in the main readme.
FAQs
Exposes custom properties, custom media queries and custom selectors to JavaScript
The npm package css-customs-loader receives a total of 13 weekly downloads. As such, css-customs-loader popularity was classified as not popular.
We found that css-customs-loader 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.