
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Ternary operator for Gulp.
First, install gulp-cond
as a development dependency:
npm install --save-dev gulp-cond
Then, use it to conditionally pipe plugins in your gulpfile.js
:
import cond from 'gulp-cond';
var prod = gulp.env.prod;
// Images
gulp.task('build_images', function() {
gulp.src('assets/images/**/*.svg')
.pipe(cond(prod,
gSvgmin(options), // minify SVG images under production
gWatch().pipe(gLivereload(server))) // use live reload in dev mode
)
.pipe(gulp.dest('www/images'))
});
Alternatively, you can provide plugin functions instead of streams to instantiate streams only when needed :
import cond from 'gulp-cond';
var prod = gulp.env.prod;
// Images
gulp.task('build_images', function() {
gulp.src('assets/images/**/*.svg')
.pipe(cond(prod,
gSvgmin.bind(null, options), // minify SVG images under production
function () { // use live reload in dev mode
return gWatch().pipe(gLivereload(server));
})
)
.pipe(gulp.dest('www/images'))
});
Type: Boolean
or Function
Required. A value or a function providing a value. If the value is truthy, expr1 will be used, else, expr2 will be use if provided.
Type: Stream
or Function
Required. A stream or a function providing a stream.
Type: Stream
or Function
Default value: Stream.PassThrough
A stream or a function providing a stream.
You may want to contribute to this project, pull requests are welcome if you accept to publish under the MIT license.
FAQs
Ternary operator for Gulp.
The npm package gulp-cond receives a total of 4,879 weekly downloads. As such, gulp-cond popularity was classified as popular.
We found that gulp-cond 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
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.