How to speed up Assembly and minification js scripts?

Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
There are four js file: two sided, two written by hand. The speed of minification of the target file is always the same - 20 seconds how you can reduce?

That's the part of the code in helpfile:
var gulp = require("gulp"), concat = require("gulp-concat"), uglify = require("gulp-uglifyjs"); gulp.task("auto-scripts", function() { return gulp.src([ "app/public/vendors/jquery/jquery.min.js", "app/public/vendors/ckeditor/ckeditor.js" ]) .pipe(concat("auto-scripts.js")) .pipe(gulp.dest("app/public/meta/js")) }) gulp.task("hand-scripts", function() { return gulp.src([ "app/public/js/application.js", "app/public/meta/js/script.js" ]) .pipe(concat("hand-scripts.js")) .pipe(gulp.dest("app/public/meta/js")) }); gulp.task("scripts", ["auto-scripts", "hand-scripts"], function() { return gulp.src([ "app/public/meta/js/auto-scripts.js", "app/public/meta/js/hand-scripts.js" ]) .pipe(concat("scripts.min.js")) .pipe(uglify()) .pipe(gulp.dest("app/public/meta/js")) });
by | 15 views

2 Answers

0 like 0 dislike
  1. No need to rebuild vendors on everyone.
  2. No need to minifirewall on everyone.

There are two modes of script development and production.
In development mode you don't peresource vendors with vetcherom, connect the two files in html (shareware vendor.js and main.js), generate source maps, not minimizarea code.
When everything is ready, you assemble the build for the website — glue everything in one file, minimizarea code, shut off the source card.
0 like 0 dislike
Make a dev build, which not will be made minification. You only need to send to production, but during development you can use a short script (it is even easier to debug in the browser). i.e. write in the console
gulp build --env development
And get to develop, without minification. If so
gulp build --env production
Then ineficacia.
This thing will help and then just replace
var environments = require('gulp-environments'); var development = environments.development; var production = environments.production; ..... .pipe(production(uglify()))

Related questions

0 like 0 dislike
2 answers
0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
0 like 0 dislike
3 answers
110,608 questions
257,186 answers
35,431 users