Questions tagged [gulp-uglify]

gulp-uglify is a gulp plugin for files minification using UglifyJS.

gulp-uglify integrates files minification using UglifyJS into gulp workflow. It's as easy to use as:

var uglify = require('gulp-uglify');

gulp.task('make-it-ugly', function() {
  return gulp.src('app/components/*.js')
    .pipe(uglify())
    .pipe(gulp.dest('build'));
});

gulp-uglify npm package: https://www.npmjs.com/package/gulp-uglify.

251 questions
2
votes
1 answer

How to deploy project local to production server using gulp?

I want to deploy my project local to production server. At my local machine I am using gulp build gulp serve command. This command is redirected to me at http://localhost:3000. When I added code on production server and run these command. it is…
2
votes
0 answers

How to fix Sourcemap pointing to wrong file/line?

I've created a Gulp Task that will compile my application with browserify/babelify and would love to have sourcemaps for it. However the sourcemaps point to the wrong file / line. Since I'm not able to post images (because of my reputation required…
Kapulara
  • 301
  • 1
  • 6
2
votes
1 answer

Gulp AssertionError [ERR_ASSERTION]: Task function must be specified after Node and NPM update

I just started learning gulp and i followed this tutorial series: https://www.youtube.com/watch?v=ax0ykSVPufs&list=PLriKzYyLb28lp0z-OMB5EYh0OHaKe91RV&index=7 I got this all working until i updated my node and npm versions,i encountered an error.…
Twirlman
  • 1,109
  • 2
  • 12
  • 30
2
votes
1 answer

Prevent function name to get mangled while minification

I'm using gulp-uglify ~1.5.4 for my javascript minification, in a file a have this code : columns[j].colDef.cellRenderer.name === 'dateRenderer', cellRenderer is a function so cellRenderer.name will return he name of that function. So when the…
Renaud is Not Bill Gates
  • 1,684
  • 34
  • 105
  • 191
2
votes
0 answers

Gulp Concat + Uglify order JS error

I'm trying to concat and uglify javascript files in a specific order. When i disable uglify it works well as i order. But when i turn on uglify, the JS order is ignored. What am i doing wrong? Script_1.js let script_one = () => { …
Johnson
  • 1,396
  • 6
  • 17
  • 36
2
votes
2 answers

Skip uglifying already compressed files with Gulp

I have a situation where I was currently uglifying all JavaScript files even if they were already compressed, which obviously isn't a great idea. My respective task was: gulp.task('uglify', ['scripts'], function() { return…
Brett
  • 19,449
  • 54
  • 157
  • 290
2
votes
1 answer

gulp stopping gulp process on any error

i am using gulp in my project for prod build related activities. I have tasks like following gulp.task('bundle-libs', bundlelibs); gulp.task('bundle-modules', bundle); /* build libs for production */ gulp.task('build:prod', function (done) { …
Vikhyath Maiya
  • 3,122
  • 3
  • 34
  • 68
2
votes
2 answers

Gulp - events error with gulp-uglify

I'm working on a HTML/JS/CSS website and I use Gulp as automation tool. It works perfectly fine when running gulp serve but I receive the following errors when running gulp build: [18:24:52] Using gulpfile myProject/gulpfile.js [18:24:52] Starting…
Fred
  • 639
  • 4
  • 14
  • 27
2
votes
1 answer

Error: $injector:unpr Unknown Provider in angularjs with gulp-uglify

I've added .run function as follow: coursesApp.run(['$rootScope'], function ($rootScope) { $rootScope.slugLinkCompany = function(item, link) { if (item) { var makeSlug = item.name.toLowerCase().replace(/[^\w…
PPShein
  • 13,309
  • 42
  • 142
  • 227
2
votes
1 answer

GulpUglifyError: unable to minify JavaScript (Angular 4)

I have a problem with uglify main bundle.js file. This is my gulp scripts: gulp.task("compile", () => { let tsResult = gulp.src("app/**/*.ts") .pipe(sourcemaps.init()) .pipe(tsProject()); return tsResult.js …
Taras Kovalenko
  • 2,323
  • 3
  • 24
  • 49
2
votes
2 answers

gulp-uglify + Uncaught Error: [$injector:modulerr]

Trying to uglify the js files. When I use the bundle file in index.html. I get below error. Below is my gulp file. 'use-strict' var gulp = require('gulp'); var uglify = require('gulp-uglify'); var concat = require('gulp-concat'); var exec =…
user7353226
  • 55
  • 2
  • 8
2
votes
1 answer

Gulp-Uglify: $(void 0) when caching DOM

When using gulp-uglify and caching DOM elements (with jQuery), uglify makes $(void 0) out of $(this). $(document).on("click", "sth", () => { var $this = $(this); ... }); Will result in this: $(document).on("click", "sth", function() { …
sandrooco
  • 8,016
  • 9
  • 48
  • 86
2
votes
2 answers

gulp-uglify won't preserve files order

When I use gulp-uglify to minify the Javascript files the order gets messed up. Lets say I have this task working as expected: var gulp = require('gulp'); var rename = require('gulp-rename'); var gp_concat = require('gulp-concat'); gulp.task('js',…
Alvaro
  • 40,778
  • 30
  • 164
  • 336
2
votes
1 answer

gulp-usemin not outputting js files

I am trying to use gulp-usemin to bundle my CSS and javascript files for production. gulp-usemin is working fine on my CSS files, but is not outputting anything in relation to my javascript files. Can somebody point out to me what I'm doing…
Nathan
  • 1,897
  • 2
  • 15
  • 16
2
votes
3 answers

How to load minified file in angular 2 using gulp uglify ? (which minifies TYpescript Bundled File)

I have a angular 2 application in which typescript compiler options is defined to generate a single outFile which is Scripts1.js and Scripts1.js.map Now in my index.html