Socket
Socket
Sign inDemoInstall

gulp-eval

Package Overview
Dependencies
12
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    gulp-eval

require or eval modules


Version published
Weekly downloads
90
decreased by-18.18%
Maintainers
3
Install size
211 kB
Created
Weekly downloads
 

Readme

Source

gulp-eval

Require CommonJS modules, JSON files or files with JS-expression inside gulp tasks with ease.

NPM version Build Status Coverage Status Dependency Status

gulp-eval fills data property of Vinyl objects.

Usage example:

var gulp = require('gulp');
var concat = require('gulp-concat');
var gulpEval = require('gulp-eval');
var through = require('through2');

gulp.task('default', () =>
  gulp.src('node_modules/*/package.json')
    .pipe(gulpEval())
    .pipe(through.obj(function(file, enc, next) {
      var data = file.data; // Here we have evaluated package.json
      file.contents = new Buffer(data.name + '#' + data.version);
      next(null, file);
    }))
    .pipe(concat('packages.txt'))
    .pipe(gulp.dest('dest/'))
);

Context

You can provide some like-a-global variables into gulp-eval

var gulpEval = require('gulp-eval');
var globalVar = 42;
var transformStream = gulpEval({globalVar: globalVar});

// globalVar will be in context of evaluated code

Keywords

FAQs

Last updated on 29 Apr 2016

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc