Keep global variables in gulp

1.1k views Asked by At

I am using gulp to minify my JS files. However I am minifying some library files also.(Backbone.js).

Now I can't access global variable declared on that library files (Backbone). In console it is undefined.

I am pretty sure that I have to pass some argument in uglify of gulp (this is my guess).

But what

my gulp code

var gulp = require('gulp');
var wrap = require('gulp-wrap');
var declare = require('gulp-declare');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');

gulp.task('minify-js', function() {
    gulp.src("libs/*.js")
        .pipe(concat('common-script.min.js'))
        .pipe(uglify())
        .pipe(gulp.dest('js/'));
});
0

There are 0 answers