
Research
/Security News
Popular Tinycolor npm Package Compromised in Supply Chain Attack Affecting 40+ Packages
Malicious update to @ctrl/tinycolor on npm is part of a supply-chain attack hitting 40+ packages across maintainers
css-file-loader
Advanced tools
npm i --save-dev css-file-loader
This loader clones files (images, fonts ...) which referenced from css file like url (./image.png)
.
.selector {
background: url(./img.png) no-repeat -122px -293px;
width: 16px;
}
it will be replaced by
.selector {
background: url([options.publicPath]/[file hash].png) no-repeat -122px -293px;
/*For example url(http://localhost/ad31..2a.png) */
width: 16px;
}
and [file hash].png
will copy to output.path folder and filename replaced by file hash [file hash].png
module.exports = {
module: {
rules: [
{
test: /\.css$/,
use: [ 'css-loader', 'css-file-loader' ]
}
]
}
}
Combine with other loaders like sass
...
rules: [
{
test: /\.scss$/,
use: [ 'css-loader', 'css-file-loader', 'sass-loader' ]
}
]
...
Name | Type | Default | Description |
---|---|---|---|
publicPath | {String} | output.publicPath or / if options.publicPath and output.publicPath are empty | This option specifies the public URL of the output directory when referenced in a browser.Must have slash at the end /hello/ |
{
test: /\.scss$/,
use: [
{loader: "css-loader"},
{
loader: "css-file-loader", options: {
publicPath: "/hello/" ,
}
},
{loader: "sass-loader"}
]
}
FAQs
[![npm][npm]][npm-url] [![deps][deps]][deps-url]
We found that css-file-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.
Research
/Security News
Malicious update to @ctrl/tinycolor on npm is part of a supply-chain attack hitting 40+ packages across maintainers
Security News
pnpm's new minimumReleaseAge setting delays package updates to prevent supply chain attacks, with other tools like Taze and NCU following suit.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.