gulp-obfuscator-wrapper
v0.3.1
Published
A Gulp wrapper for Obfuscator
Downloads
2
Maintainers
Readme
Gulp Obfuscator Wrapper
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.