O
O
OlegSedoy2017-09-21 11:59:06
gulp.js
OlegSedoy, 2017-09-21 11:59:06

What settings to change in uglify?

There is a task:

gulp.task('scripts', function() {
  return gulp.src([
    dir.assets + '/library/jquery/dist/jquery.js',
    dir.assets + '/library/fotorama/fotorama.js',
    dir.assets + '/js/main.js'
    ])
  .pipe(sourcemaps.init())
  .pipe(concat('scripts.min.js'))
  .pipe(uglify())
  .pipe(gulp.dest(''))
  .pipe(sourcemaps.write('souremaps/'))
  .pipe(browserSync.reload({stream: true}));
});

fotorama stops working, error:
Uncaught TypeError: Cannot read property 'createElement' of undefined
If you disable .pipe(uglify()), then everything works. What option to enable in uglify? Compression options?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Serezha Gromkov, 2018-03-26
@sgromkov

Also faced this problem. the solution from here helped me: https://github.com/artpolikarpov/fotorama/issues/528
I took the photo frame script from the comment, and with it everything was compressed and assembled.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question