gulp-obfuscator-wrapper

A Gulp wrapper for Obfuscator

Usage no npm install needed!

<script type="module">
  import gulpObfuscatorWrapper from 'https://cdn.skypack.dev/gulp-obfuscator-wrapper';
</script>

README

Gulp Obfuscator Wrapper

Build Test Coverage Code Climate Downloads Version Dependency Status

This is a wrapper around the great node-obfuscator library by stephenmathieson. It was made simply because I needed it for my own builds.

Install

npm install --save-dev gulp-obfuscator-wrapper

Use

var obfuscator = require('gulp-obfuscator-wrapper');
var rename = require('gulp-rename');

gulp.task('obfuscate', function() {
    // it is important to set the base
    return gulp.src('path/to/my/**/*.js', { base: 'path/to/my' })
        .pipe(obfuscator({
            // options are similar to Obfuscator options
            entry: 'main.js',
            strings: true,
            compressor: {
                // any options for compressor
            }
        }))
        // default name is obfuscated.js, so you'll probably
        // want to change it
        .pipe(rename('my-name.js'))
        .pipe(gulp.dest('./'));
});

In case you did not see the comment mixed in the code, it is very important to define base in your gulp.src call. While this module might likely work without it, it will help to make sure that your project gets obfuscated correctly, especially with large projects that have a complex nested folder structure, or if you use absolute file paths when defining your sources or entry file.

Analytics