Why has stopped working minification of js files?


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
43 views
Equally ceased to shrink js files, build stably for a long time, recent changes have been made.
Actually are making a healthy piece of code.

"use strict"; var gulp = require("gulp"), debug = require('gulp-debug'), autoprefixer = require("gulp-autoprefixer"), cssbeautify = require("gulp-cssbeautify"), removeComments = require('gulp-strip-css-comments'), rename = require("gulp-rename"), ngrok = require('ngrok'), webserver = require("browser-sync"), sass = require("gulp-sass"), cssnano = require("gulp-cssnano"), rigger = require("gulp-rigger"), uglify = require("gulp-uglify"), watch = require("gulp-watch"), plumber = require("gulp-plumber"), imagemin = require("gulp-imagemin"), imageminJpegRecompress = require('imagemin-jpeg-recompress'), pngquant = require('imagemin-pngquant'), run = require("run-sequence").use(gulp), rimraf = require("rimraf"), cached = require('gulp-cached'), cache = require('gulp-cache'), newer = require('gulp-newer'), gutil = require('gulp-util'); /* Paths to source/build/watch files =========================*/ var path = { build: { html: "build/", js: "build/assets/js/", css: "build/assets/css/", img: "build/assets/i/", fonts: "build/assets/fonts/" }, src: { html: "src/*.{htm,html}", js: "src/assets/js/*.js", css: "src/assets/sass/style.scss", img: "src/assets/i/**/*.*", fonts: "src/assets/fonts/**/*.*" }, watch: { html: "src/**/*.{htm,html}", js: "src/assets/js/**/*.js", css: "src/assets/sass/**/*.scss", img: "src/assets/i/**/*.*", fonts: "src/assets/fonts/**/*.*" }, clean: "./build" }; /* Webserver config =========================*/ var config = { server: { baseDir: "build/" }, tunnel: true host: 'localhost', port: 3000, directoryListing: true, logPrefix:" }; /* Tasks =========================*/ gulp.task("webserver", function () { webserver(config, function (err, bs) { ngrok.connect({ proto: 'http', // the http|tcp|tls addr: bs.options.get('port'), // port or network address }, function (err, url) { gutil.log('[ngrok]', ' => ', gutil.colors.magenta.underline(url)); }); }); }); /* Build the HTML ==================================*/ gulp.task("html:build", function () { return gulp.src(path.src.html) .pipe(plumber()) .pipe(rigger()) .pipe(gulp.dest(path.build.html)) .pipe(webserver.reload({stream: true})); }); /* Build CSS ==================================*/ gulp.task("css:build", function () { return gulp.src(path.src.css) // .pipe(cached('sass')) .pipe(plumber()) .pipe(sass()) .pipe(autoprefixer({ browsers: ["last 5 versions"], cascade: true })) .pipe(removeComments()) .pipe(cssbeautify()) .pipe(gulp.dest(path.build.css)) .pipe(cssnano({ zindex: false, discardComments: { removeAll: true } })) .pipe(rename("style.min.css")) .pipe(gulp.dest(path.build.css)) .pipe(webserver.reload({stream: true})); }); /* Build JS ==================================*/ gulp.task("js:build", function () { return gulp.src(path.src.js) .pipe(plumber()) .pipe(rigger()) .pipe(gulp.dest(path.build.js)) .pipe(uglify()) .pipe(removeComments()) .pipe(rename("main.min.js")) .pipe(gulp.dest(path.build.js)) .pipe(webserver.reload({stream: true})); }); /* Build fonts ==================================*/ gulp.task("fonts:build", function() { return gulp.src(path.src.fonts) .pipe(gulp.dest(path.build.fonts)); }); /* Build the IMG ==================================*/ gulp.task("image:build", function () { return gulp.src(path.src.img) .pipe(cache(imagemin([ imagemin.jpegtran({progressive: true}), imageminJpegRecompress({ loops: 5, min: 65, max: 70, quality:'medium' }), imagemin.svgo(), imagemin.optipng({optimizationLevel: 3}), pngquant({quality: '65-70', speed: 5}) ],{ verbose: true }))) .pipe(gulp.dest(path.build.img)); }); gulp.task("clean", function (cb) { rimraf(path.clean, cb); }); gulp.task('build', function (cb) { run( "clean", "html:build", "css:build", "js:build", "fonts:build", "image:build" , cb); }); gulp.task("watch", function() { watch([path.watch.html], function(event, cb) { gulp.start("html:build"); }); watch([path.watch.css], function(event, cb) { gulp.watch('src/assets/i/**/*.*', ['image:build']); gulp.start("css:build"); }); watch([path.watch.js], function(event, cb) { gulp.start("js:build"); }); watch([path.watch.img], function(event, cb) { gulp.start("image:build"); }); watch([path.watch.fonts], function(event, cb) { gulp.start("fonts:build"); }); }); gulp.task("default", function (cb) { run( "clean", "build" "webserver", "watch" , cb); });
by | 43 views

1 Answer

0 like 0 dislike
Solved the problem. The problem was not in the Assembly configuration file, and the connection is correct custom js files in the global file main.js (no matter how paradoxical it may sound). You may not know that if in the html code the block of code goes first and the General Assembly file js it needs to go above the rest, now I know from experience.
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
asked Apr 9, 2019 by dreamfdr
0 like 0 dislike
2 answers
0 like 0 dislike
2 answers
0 like 0 dislike
2 answers
asked Jun 6, 2019 by KononovD
110,608 questions
257,186 answers
0 comments
36,634 users