gulp-uglify

how to debug gulp-sourcemaps not doing anything?

梦想与她 提交于 2019-12-10 14:47:52
问题 I have a fairly standard use case for gulp-sourcemaps https://github.com/floridoo/gulp-sourcemaps gulp.src( bundle.src) .pipe(sourcemaps.init()) .pipe(concat(bundle.dst + '.' + opts.ext)) .pipe(uglify()) .pipe(sourcemaps.write()) .pipe(gulp.dest('./public/built')); This produces appropriately concatenated and uglyified files. However there are no source map additions to them. bundle.src is an array of file paths. Not sure how to debug this. 回答1: You should look into gulp-util. It may give you

gulp-uglify won't preserve files order

不羁岁月 提交于 2019-12-10 10:56:46
问题 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', function() { gulp.src([ './public/bower_components/jquery/dist/jquery.min.js', './public/js/functions.js', ]) .pipe(gp_concat('combined.js')) .pipe(gulp.dest(path.js + '/dist')) }); Adding the uglify line to it changes the order of the jquery and

Make gulp-uglify not mangle only one variable

随声附和 提交于 2019-12-08 14:58:09
问题 I just wanted to check if there is a way to mangle variables except a specific one for Gulp-Uglify. If there isn't, is there a work-around to achieve the effect I desire? Thanks. 回答1: There definitely is, I couldn't find any documentation for gulp-uglify regarding these sub-options, so relied on grunt-uglify & wrote it the gulp way. .pipe( uglify({ mangle: {except: ['jQuery']} }) ) // for gulp-uglify ^2.0.1 The above code will mangle every variable except jQuery Hopefully this will still be

gulp-uglify won't preserve files order

梦想的初衷 提交于 2019-12-06 09:56:55
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', function() { gulp.src([ './public/bower_components/jquery/dist/jquery.min.js', './public/js/functions.js', ]) .pipe(gp_concat('combined.js')) .pipe(gulp.dest(path.js + '/dist')) }); Adding the uglify line to it changes the order of the jquery and functions files and places functions.js above jquery . var gulp = require('gulp'); var rename = require(

CSS and JS minification doesn't work with gulp-filter, gulp-csso, gulp-uglify

佐手、 提交于 2019-12-06 05:16:04
I'm working thorough johnpapa's course on automation with Gulp and seem to hit a weird wall: when I'm trying to run the CSS and JS concatenation and minification task it fails to do the minification. This is the task: gulp.task('optimize', ['inject'], function () { var assets = $.useref.assets({searchPath: ''}); var cssFilter = $.filter(['**/*.css'], {restore: true}); var jsFilter = $.filter(['**/*.js'], {restore: true}); return gulp .src(config.indexFile) .pipe($.rename('test.jsp')) .pipe($.plumber()) .pipe(assets) .pipe(cssFilter) .pipe($.csso()) .pipe(cssFilter.restore) .pipe(jsFilter)

Gulp Uglify Options not applying

人盡茶涼 提交于 2019-12-05 08:26:59
Hi I am making a theme for the company i work at and the JS segments will not build properly in uglify. I am trying to use uglify to simply concatenate my files, which works but they output minified and mangled with no comments and i cannot figure out why, below is my gulp task which runs correctly but doesnt output with the options provided gulp.task('js', function() { return gulp.src('./src/js/*.js') .pipe(uglify({ options: { mangle: false, beautify: true, comments: true } })) .pipe(rename('cf247bootstrapTheme.js')) .pipe(gulp.dest('./dist/js')); }); Any ideas why this is happening? Thanks,

gulp-uglify events.js unhandled 'error' event

ⅰ亾dé卋堺 提交于 2019-12-04 10:22:24
问题 I'm getting this error. Running gulp yesterday worked perfectly fine, but this morning (changed NO code) and I'm getting this error. $ gulp [08:54:10] Using gulpfile C:\Source\Source2\bunny-meadows\gulpfile.js [08:54:10] Starting 'scripts'... [08:54:10] 'scripts' errored after 11 ms [08:54:10] TypeError: listener must be a function at TypeError (<anonymous>) at DestroyableTransform.addListener (events.js:130:11) at DestroyableTransform.Readable.on (C:\Source\Source2\bunny-meadows\node_mo

JavaScript heap out of memory in angular js gulp sourcemap ngannonate with babel

一世执手 提交于 2019-12-04 06:57:49
问题 I am using es6 syntax in my angular JS project but it throws error when run gulp build , search over github and So but some saying this is error due to gulp uglify while some say this is babel issue and other say ng-annonate issue. ubuntu 14.04 node -v : 8.4.0 npm -v : 5.3.0 babel --version : 6.26.0 (babel-core 6.26.0) package.json { "name": "Project", "version": "0.0.0", "dependencies": { "gulp-open": "^2.0.0" }, "scripts": { "test": "gulp test" }, "devDependencies": { "babel": "^6.23.0",

Uglification failed. Unexpected character '`'

狂风中的少年 提交于 2019-12-03 14:19:24
gulp-uglify is unable to uglify this piece of code: var alertString = `<?xml version="1.0" encoding="UTF-8" ?> <document> <alertTemplate> <title>${title}</title> <description>${description}</description> </alertTemplate> </document>` it complains at the character: `. The character is valid for the apple's JS framework. I can't see anything inside the uglify package to ignore those characters and the text string inside it. Am i missing something from the documentation? Gulp-uglify has yet no official support for ECMAScript 2015 (aka ES6, aka Harmony) but with a little modification the on

gulp-uglify events.js unhandled 'error' event

自闭症网瘾萝莉.ら 提交于 2019-12-03 05:35:42
I'm getting this error. Running gulp yesterday worked perfectly fine, but this morning (changed NO code) and I'm getting this error. $ gulp [08:54:10] Using gulpfile C:\Source\Source2\bunny-meadows\gulpfile.js [08:54:10] Starting 'scripts'... [08:54:10] 'scripts' errored after 11 ms [08:54:10] TypeError: listener must be a function at TypeError (<anonymous>) at DestroyableTransform.addListener (events.js:130:11) at DestroyableTransform.Readable.on (C:\Source\Source2\bunny-meadows\node_mo dules\gulp-uglify\node_modules\through2\node_modules\readable-stream\lib\_stream _readable.js:729:33) at