Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use gulp-sourcemaps for source maps #18

Merged
merged 2 commits into from
Apr 19, 2019

Conversation

DRSDavidSoft
Copy link
Contributor

@DRSDavidSoft DRSDavidSoft commented Mar 30, 2019

Description

This PR addresses a couple of issues with source maps:

Because of javascript-obfuscator/javascript-obfuscator#276, we can now use gulp-sourcemaps instead of throwing the source map to the stream! 😄

Backwards compatibility

As before, if gulp-sourcemaps is not used and obfuscator's sourceMap option is set to true, a .map file will be thrown to Gulp stream.

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

NOTE: The old method is not recommended for new projects, for the following reasons:

  1. Any gulp plugin that is chained after gulp-javascript-obfuscator (e.g. gulp-header to prepend a banner to the output file) will be applied on both the obfuscated .js file and its .map file.

  2. You will not be able to chain any other plugins to the task without loosing its own sourcemap file.

@Wain-PC Wain-PC merged commit 4c1acb4 into javascript-obfuscator:master Apr 19, 2019
@Wain-PC
Copy link
Contributor

Wain-PC commented Apr 19, 2019

Thank you, looks good to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Specify inputFileName for javascript-obfuscator 0.17.0
2 participants