
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
csso-next-loader
Advanced tools
CSSO loader module for webpack.
npm install csso-loader --save-dev
Using csso-loader with css-loader.
module.exports = {
...
module: {
loaders: [
{
test: /\.css$/,
loader: 'css-loader!csso-loader',
}
]
}
};
Default: true
csso
performs structural optimization for better compression by default.
Use -restructure
in case you want to disable it.
module.exports = {
...
module: {
loaders: [
{
test: /\.css$/,
loader: 'css-loader!csso-loader?-restructure',
}
]
}
};
Also it can be disabled by restructure
boolean option in csso
object of webpack config.
module.exports = {
...
module: {
loaders: [
{
test: /\.css$/,
loader: 'css-loader!csso-loader',
}
]
},
csso: {
restructure: false
}
};
Default: false
debug
is using to get details about the minification process.
module.exports = {
...
module: {
loaders: [
{
test: /\.css$/,
loader: 'css-loader!csso-loader?debug',
}
]
}
};
Also you can set debug
option in csso
object of webpack config.
It can be boolean or a positive number from 1 to 3 (greater number for more details).
module.exports = {
...
module: {
loaders: [
{
test: /\.css$/,
loader: 'css-loader!csso-loader',
}
]
},
csso: {
debug: 3
}
};
Default: exclamation
or true
csso
leave all exclamation comments by default (i.e. /*! .. */
).
Use '-comments' to remove all comments.
module.exports = {
...
module: {
loaders: [
{
test: /\.css$/,
loader: 'css-loader!csso-loader?-comments',
}
]
}
};
Also you can set comments
option in csso
object of webpack config.
It can be boolean or string (use first-exclamation
to remove all comments except first one with exclamation).
module.exports = {
...
module: {
loaders: [
{
test: /\.css$/,
loader: 'css-loader!csso-loader',
}
]
},
csso: {
comments: 'first-exclamation'
}
};
With usage
option you can set data about CSS usage. For example, white lists (tags
, ids
and classes
) can be set to filter unused selectors and related CSS rules as well. See Usage data in csso
documentation for more details.
module.exports = {
...
module: {
loaders: [
{
test: /\.css$/,
loader: 'css-loader!csso-loader',
}
]
},
csso: {
usage: {
tags: ['span', 'div'],
ids: ['id1'],
classes: ['class1', 'class2', 'class3', 'class4']
scopes: [
['class1', 'class2'],
['class3', 'class4']
]
}
}
};
To log how CSS is transforming through compression stages use logger
option.
First argument is a stage name, and second one is AST of current state CSS or null
.
module.exports = {
...
module: {
loaders: [
{
test: /\.css$/,
loader: 'css-loader!csso-loader',
}
]
},
csso: {
logger: function(stage, ast) {
console.log(stage, ast);
}
}
};
MIT © Andrew Smirnov
FAQs
CSSO loader module for webpack
We found that csso-next-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.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.