
Security News
Socket Releases Free Certified Patches for Critical vm2 Sandbox Escape
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.
@localnerve/gulp-responsive
Advanced tools
This is mostly the same as the original except with updated dependencies and code.
Generates images at different sizes
Exposes a
postprocessoption to allow you to capture the work of this transform and use it in other build operations.
gulp-responsive depends on sharp. Sharp is one of the fastest Node.js modules for resizing JPEG, PNG, WebP and TIFF images.
If you are using Mac OS then before installing gulp-responsive you should install the libvips library. Further information and instructions can be found in the sharp installation guide.
$ npm install --save-dev gulp-responsive
import gulp from 'gulp'
import responsive from 'gulp-responsive'
gulp.task('default', function () {
return gulp
.src('src/*.{png,jpg}')
.pipe(
responsive({
'background-*.jpg': {
width: 700,
quality: 50
},
'cover.png': {
width: '50%',
// convert to jpeg format
format: 'jpeg',
rename: 'cover.jpg'
},
// produce multiple images from one source
'logo.png': [
{
width: 200
},
{
width: 200 * 2,
rename: 'logo@2x.png'
}
]
})
)
.pipe(gulp.dest('dist'))
})
Configuration can be provided in one of the following formats:
;[
{
name: 'logo.png',
width: 200,
height: 100
},
{
name: 'banner.png',
width: 500
}
]
{
'logo.png': {
width: 300,
height: 200,
rename: 'logo@2x.png'
},
'background-*.png': {
width: 1400,
withoutEnlargement: true
}
}
{
'logo.png': [{
width: 200,
rename: 'logo@1x.png'
},{
width: 400,
rename: 'logo@2x.png'
}],
'background-*': [{
height: 400
}]
}
Configuration unit is an object:
true.false.width and height specified.width and height have to be defined), default false.80.false.false.6.extname is specified, output format is parsed from extension. You can override this autodetection with format option.jpeg, png, webp or raw, default is null.false.width or height specified then embed on a background of the exact width and height specified, default is false.width and/or height provided via resize, default is false.lanczos3.fff'.background, default is false.false.Orientation tag, default is false.flip implies the removal of the EXIF Orientation tag, if any. Default is false.flop implies the removal of the EXIF Orientation tag, if any. Default is false.false.false.false.1/gamma then increasing the encoding (brighten) post-resize at a factor of gamma. Default is false.false.false.false.false.false.Detailed description of each option can be found in the sharp API documentation.
Renaming is implemented by the rename module. Options correspond with options of gulp-rename.
Type: Boolean
Default: true
Emit the error when configuration is not used.
Type: Boolean
Default: true
Emit the error when image is not used.
Type: Boolean
Default: false
Keep unmatched images in the stream.
To use this option errorOnUnusedImage should be false.
Type: Boolean
Default: true
Emit the error when image is enlarged.
Type: Boolean
Default: true
Show statistics after the run β how many images were created, how many were matched and how many were in the run in total.
Type: Boolean
Default: false
Silence messages and stats if 0 images were created. If you wish to supress all messages and stats, set the options.stats to false as well.
Type: Function
Default: undefined
If you supply a postprocess function, it will be called after every successfully processed file. It receives a vinyl object of the original file, the config used to process it, and a vinyl object of the new file. For Vinyl object details, see vinyl.
Signature: function postprocess (originalVinylFile, config, newVinylFile)
You can specify global default value for any of the configuration options.
gulp.task('default', function () {
return gulp
.src('src/*.png')
.pipe(
responsive(config, {
// global quality for all images
quality: 50,
errorOnUnusedImage: false
})
)
.pipe(gulp.dest('dist'))
})
MIT Β© Evgeny Vlasenko
FAQs
small patch for gulp-responsive
We found that @localnerve/gulp-responsive demonstrated a healthy version release cadence and project activity because the last version was released less than 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 critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.

Research
Five malicious NuGet packages impersonate Chinese .NET libraries to deploy a stealer targeting browser credentials, crypto wallets, SSH keys, and local files.

Security News
pnpm 11 turns on a 1-day Minimum Release Age and blocks exotic subdeps by default, adding safeguards against fast-moving supply chain attacks.