Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
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 0 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
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.