N
N
Nicholas2014-09-24 16:39:30
JavaScript
Nicholas, 2014-09-24 16:39:30

Gulp, browserify - how to make a minified js file + source map?

More recently, I got acquainted with these assembly tools and immediately ran into a problem.
The task is to make a minified + map file from the generated browserify file.
Now I have this gulpfile:

var gulp = require('gulp'),
    browserify = require('browserify'),
    source = require('vinyl-source-stream');

gulp.task('browserify', function() {
    return browserify('./app/main.js', {debug : true})
        .bundle()
        .pipe(source('bundle.js'))
        .pipe(gulp.dest('./'));
});

The output is a file without minification with an inline sourcemap.
How to achieve the desired result and did not understand. I tried a bunch of different npm modules uglify-js, gulp-uglify, gulp-uglifyjs and others, and ended up with a minified file without a source map.
In general - tell me which way to dig.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman Shishkin, 2015-07-28
@Chuv

https://www.npmjs.com/package/gulp-sourcemaps

V
Valery Harshats, 2015-01-28
@Valery4

I advise you to look in full, there is a lot of interesting things, but on the topic of the question - I will add a link to the desired piece. youtube.be/65O-kmgmRI4?t=55m7s

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question