G
G
germani2014-09-26 11:58:10
JavaScript
germani, 2014-09-26 11:58:10

How to make minified js in the same folder using gulp-uglifyjs ?

For some time now, the question has not left me how to make minified js files side by side,

gulp.task('uglify', function() {
  gulp.src('js/**/*.js')
    .pipe(uglify())
    .pipe(gulp.dest('dest'))
});

this example will take files from all folders and put one in ./dest,
but I want to make a minified one next to a non-minified file.
is it possible without recursively traversing all folders.
thanks in advance for the replies.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2014-09-26
Protko @Fesor

Write your plugin, with blackjack, etc. which will take all the files from the stream and do aggregation (you can use gulp-uglify as a basis). uglifyjs concatenates all files by default, otherwise there is not much point in such optimization.
Well, as an option - expand the glob and get a list of files, form an array of streams and apply uglify to each. Essentially the same as with the option with the plugin but without the plugin.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question