
Security News
GitHub Actions Supply Chain Attack Puts Thousands of Projects at Risk
A compromised GitHub Action exposed secrets in CI/CD logs, putting thousands of projects at risk and forcing developers to urgently secure their workflows.
imagemin-keep-folder
Advanced tools
Minify images seamlessly
Fork form imagemin.
support keep and customize folder structure
$ npm install --save-dev imagemin-keep-folder
// as usual
const imagemin = require('imagemin-keep-folder');
imagemin(['images/*.{jpg,png}'], 'build/images', {
}).then(files => {
console.log(files);
//=> [{data: <Buffer 89 50 4e …>, path: 'build/images/foo.jpg'}, …]
});
// keep folder structure as input
const imagemin = require('imagemin-keep-folder');
imagemin(['images/**/*.{jpg,png}'], {
});
// for example
// images/a.jpg => images/a.jpg
// images/foo/a.jpg => images/foo/a.jpg
// images/foo/bar/a.jpg => images/foo/bar/a.jpg
// keep folder structure as input use imagemin-webp
const imagemin = require('imagemin-keep-folder');
const imageminWebp = require("imagemin-webp");
imagemin(['images/**/*.{jpg,png}'], {
use: [
imageminWebp({})
]
});
// for example
// images/a.jpg => images/a.webp
// images/foo/a.jpg => images/foo/a.webp
// images/foo/bar/a.jpg => images/foo/bar/a.webp
// customize folder structure as input use imagemin-webp
const imagemin = require('imagemin-keep-folder');
const imageminWebp = require("imagemin-webp");
imagemin(['images/**/*.{jpg,png}'], {
use: [
imageminWebp({})
],
replaceOutputDir: output => {
return output.replace(/images\//, '.webp/')
}
});
// for example
// images/a.jpg => .webp/a.webp
// images/foo/a.jpg => .webp/foo/a.webp
// images/foo/bar/a.jpg => .webp/foo/bar/a.webp
Returns Promise<Object[]>
in the format {data: Buffer, path: String}
.
Type: Array
Files to be optimized. See supported minimatch
patterns.
Type: string
Set the destination folder to where your files will be written. If no destination is specified no files will be written. If no destination is specified, files will be written and keep folder structure
Type: Object
Type: Function
Returns String
(new output dir)
Type: Array
Plugins to use.
Returns Promise<Buffer>
.
Type: Buffer
Buffer to optimize.
Type: Object
Type: Array
Plugins to use.
MIT © imagemin
FAQs
Minify images
The npm package imagemin-keep-folder receives a total of 3,376 weekly downloads. As such, imagemin-keep-folder popularity was classified as popular.
We found that imagemin-keep-folder 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
A compromised GitHub Action exposed secrets in CI/CD logs, putting thousands of projects at risk and forcing developers to urgently secure their workflows.
Research
Security News
A malicious Maven package typosquatting a popular library is secretly stealing OAuth credentials on the 15th of each month, putting Java developers at risk.
Security News
Socket and Seal Security collaborate to fix a critical npm overrides bug, resolving a three-year security issue in the JavaScript ecosystem's most popular package manager.