Skip to content

Instantly share code, notes, and snippets.

@PezCoder
Created November 27, 2019 07:12
Show Gist options
  • Save PezCoder/3a79df6764ad304781c9506d6229055c to your computer and use it in GitHub Desktop.
Save PezCoder/3a79df6764ad304781c9506d6229055c to your computer and use it in GitHub Desktop.
Generating source maps with Gulp, Browserify, Uglify & Babel
var sourcemaps = require('gulp-sourcemaps');
browserify(path, {
paths: ['./node_modules'],
// Enables source maps
debug: true,
})
// Any babel config may come here
// ---
// Initialises & writes source maps
.pipe(sourcemaps.init({ loadMaps: true }))
.pipe(uglify())
.pipe(sourcemaps.write('.'))
// Used to export generated minified files & source maps
.pipe(gulp.dest('./web/js'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment