# gulp-javascript-obfuscator

> Gulp plugin for javascript-obfuscator Node.JS package

Latest version **1.1.6** (published 2019-04-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-javascript-obfuscator
pnpm add gulp-javascript-obfuscator
yarn add gulp-javascript-obfuscator
bun add gulp-javascript-obfuscator
```

## Health

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

Positive: has types package; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.6 |
| Published | 2019-04-19 |
| First published | 2016-10-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/gulp-javascript-obfuscator) |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 29.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 103 |
| Author | Wain-PC |
| Maintainers | wain-pc |
| Keywords | gulpplugin, obfuscate, obfuscation, javascript-obfuscator, obfuscator, obfuscate, protect, conceal, scramble, safe, uglify, crush, code protection, javascript obfuscator, js obfuscator |

## Links

- npm: https://www.npmjs.com/package/gulp-javascript-obfuscator
- Repository: https://github.com/javascript-obfuscator/gulp-javascript-obfuscator
- Issues: https://github.com/javascript-obfuscator/gulp-javascript-obfuscator/issues
- npm.io page: https://npm.io/package/gulp-javascript-obfuscator

## Dependencies (4)

- [vinyl](https://npm.io/package/vinyl.md) ^2.2.0
- [through2](https://npm.io/package/through2.md) ^2.0.0
- [plugin-error](https://npm.io/package/plugin-error.md) ^1.0.1
- [javascript-obfuscator](https://npm.io/package/javascript-obfuscator.md) latest

## Recent versions

- 1.1.6 (latest) — 2019-04-19
- 1.1.5 — 2018-11-13
- 1.1.4 — 2017-12-01
- 1.1.3 — 2017-11-13
- 1.1.2 — 2016-11-21
- 1.1.1 — 2016-11-18
- 1.1.0 — 2016-10-27
- 1.0.0 — 2016-10-26

## README

# gulp-javascript-obfuscator

Gulp plugin for [javascript-obfuscator](https://github.com/javascript-obfuscator/javascript-obfuscator)

## Installation

Install the package with npm:

```bash
$ npm install --save gulp-javascript-obfuscator
```

## Usage

```javascript
const gulp = require('gulp');
const javascriptObfuscator = require('gulp-javascript-obfuscator');

gulp.src('file.js')
    .pipe(javascriptObfuscator())
    .pipe(gulp.dest('dist'));
```

## Options

[Pass any options available in the obfuscator](https://github.com/javascript-obfuscator/javascript-obfuscator#javascript-obfuscator-options)

```javascript
gulp.src('file.js')
    .pipe(javascriptObfuscator({
        compact: true
    }))
    .pipe(gulp.dest('dist'));
```

The only exception is obfuscator's `sourceMap` option which must not be set, as it will be handled automatically when using `gulp-sourcemaps`.

## Source Maps

With version `1.1.6` onwards, gulp-javascript-obfuscator can be used in tandem with [gulp-sourcemaps](https://github.com/floridoo/gulp-sourcemaps) in order to generate source maps for your javascript files.

You will need to initialize gulp-sourcemaps prior to running gulp-javascript-obfuscator and write the source maps after, as such:

```javascript
const sourcemaps = require('gulp-sourcemaps');

gulp.src('file.js')
    .pipe(sourcemaps.init())
    .pipe(javascriptObfuscator({
        compact: true
    }))
    .pipe(sourcemaps.write())
    .pipe(gulp.dest('dist'));
```

This will output a `file.js.map` file to the **dist** directory.

You can chain other gulp plugins as well:

```javascript
const sourcemaps = require('gulp-sourcemaps');

gulp.src('file.js')
    .pipe(sourcemaps.init())
    // use babel to pre-process javascript files
    .pipe(babel({
        presets: ['@babel/preset-env']
    }))
    .pipe(javascriptObfuscator({
        compact: true
    }))
    .pipe(sourcemaps.write())
    .pipe(gulp.dest('dist'));
```

### Alternative source maps method

For backwards compatibility, if `gulp-sourcemaps` is not used and obfuscator's **sourceMap** option is set to **true**, a _.map_ file will be thrown to Gulp stream. ([This method is _deprecated_ and not recommended for future use.](https://github.com/javascript-obfuscator/gulp-javascript-obfuscator/pull/18#backwards-compatibility))

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