# gulp-eval

> require or eval modules

Latest version **1.0.0** (published 2016-04-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-eval
pnpm add gulp-eval
yarn add gulp-eval
bun add gulp-eval
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2016-04-29 |
| First published | 2016-02-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Vasiliy Loginevskiy |
| Maintainers | blond, qfox, yeti-or |
| Keywords | gulp, eval, require |

## Links

- npm: https://www.npmjs.com/package/gulp-eval
- npm.io page: https://npm.io/package/gulp-eval

## Dependencies (2)

- [through2](https://npm.io/package/through2.md) ^2.0.1
- [node-eval](https://npm.io/package/node-eval.md) ^1.0.0

## Recent versions

- 1.0.0 (latest) — 2016-04-29
- 1.0.0-0 — 2016-04-17
- 0.1.0 — 2016-03-08
- 0.0.2 — 2016-02-29
- 0.0.1 — 2016-02-29

## README

# gulp-eval

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

[![NPM version](http://img.shields.io/npm/v/gulp-eval.svg?style=flat)](http://www.npmjs.org/package/gulp-eval)
[![Build Status](http://img.shields.io/travis/gulp-bem/gulp-eval/master.svg?style=flat&label=tests)](https://travis-ci.org/gulp-bem/gulp-eval)
[![Coverage Status](https://img.shields.io/coveralls/gulp-bem/gulp-eval.svg?branch=master&style=flat)](https://coveralls.io/r/gulp-bem/gulp-eval)
[![Dependency Status](http://img.shields.io/david/gulp-bem/gulp-eval.svg?style=flat)](https://david-dm.org/gulp-bem/gulp-eval)

`gulp-eval` fills `data` property of [Vinyl](https://github.com/gulpjs/vinyl) objects.

## Usage example:
```js
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

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

// globalVar will be in context of evaluated code

```

---
_Source: https://npm.io/package/gulp-eval · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
