🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

gulp-eval

Package Overview
Dependencies
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-eval

require or eval modules

latest
npmnpm
Version
1.0.0
Version published
Maintainers
3
Created
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

gulp

FAQs

Package last updated on 29 Apr 2016

Did you know?

Socket

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