Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gulp slowly working on windows 10 pro (clean) #2415

Open
VasilevskyAlex opened this issue Feb 1, 2019 · 0 comments
Open

Gulp slowly working on windows 10 pro (clean) #2415

VasilevskyAlex opened this issue Feb 1, 2019 · 0 comments

Comments

@VasilevskyAlex
Copy link

VasilevskyAlex commented Feb 1, 2019

screenshot_1
"use strict";
var gulp = require("gulp"),
autoprefixer = require("gulp-autoprefixer"),
removeComments = require('gulp-strip-css-comments'),
rename = require("gulp-rename"),
sass = require("gulp-sass"),
cssnano = require("gulp-cssnano"),
rigger = require("gulp-rigger"),
uglify = require("gulp-uglify"),
watch = require("gulp-watch"),
plumber = require("gulp-plumber"),
run = require("run-sequence"),
rimraf = require("rimraf"),
sourcemaps = require('gulp-sourcemaps'),
webserver = require("browser-sync"),
csso = require('gulp-csso'),
cache = require('gulp-cached');

/* Paths to source/build/watch files
=========================*/

var path = {
build: {
// html: "build/",
// fonts: "build/fonts"
js: "build/js",
// img: "images/",
css: "build/css"
},
src: {
html: ".{htm,html}",
js: "js/
.js",
css: "sass/style.scss"
// img: "images//.",
// fonts: "fonts/
/."
},
watch: {
html: ".{htm,html}",
js: "js/**/
.js",
css: "sass//*.scss"
// img: "images/
/.",
// fonts: "fonts/**/."
},
clean: "./build"
};

/* Webserver config
=========================*/

var config = {
server: "",
notify: false,
open: true,
ui: false
};

/* Tasks
=========================*/

gulp.task("webserver", function () {
webserver(config);
});

gulp.task("html:build", function () {
return gulp.src(path.src.html)
.pipe(plumber())
.pipe(rigger())
.pipe(webserver.reload({stream: true}));
});

gulp.task("css:build", function () {
return gulp.src(path.src.css)
.pipe(plumber())
// .pipe(sourcemaps.init())
.pipe(sass())
.pipe(autoprefixer({
browsers: ["last 5 versions"]
}))
.pipe(cssnano({
zindex: false,
discardComments: {
removeAll: true
}
}))
// .pipe(sourcemaps.write(path.build.css))
// .pipe(removeComments())
.pipe(rename("style.min.css"))
// .pipe(sourcemaps.write('.'))
.pipe(gulp.dest(path.build.css))
.pipe(webserver.reload({stream: true}));
});

gulp.task("js:build", function () {
return gulp.src(path.src.js)
.pipe(plumber())
.pipe(rigger())
.pipe(gulp.dest(path.build.js))
.pipe(uglify())
// .pipe(rename("main.min.js"))
.pipe(gulp.dest(path.build.js))
.pipe(webserver.reload({stream: true}));
});

// gulp.task("fonts:build", function() {
// gulp.src(path.src.fonts)
// .pipe(gulp.dest(path.build.fonts));
// });

// gulp.task("image:build", function () {
// gulp.src(path.src.img)
// .pipe(imagemin({
// optimizationLevel: 3,
// progressive: true,
// svgoPlugins: [{removeViewBox: false}],
// interlaced: true
// }))
// .pipe(gulp.dest(path.build.img));
// });

gulp.task("clean", function (cb) {
rimraf(path.clean, cb);
});

gulp.task('build', function (cb) {
run(
"clean",
// 'sass',
"css:build",
"js:build"
// "upload"
// "html: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.start("css:build");
});
watch([path.watch.js], function(event, cb) {
gulp.start("js:build");
});

// watch([path.watch.css, path.watch.js], function(event, cb) {
//     gulp.start("upload");
// });
// watch([path.watch.img], function(event, cb) {
//     gulp.start("image:build");
// });
// watch([path.watch.fonts], function(event, cb) {
//     gulp.start("fonts:build");
// });

});

//
// gulp.task('upload', function() {
//
//
// return gulp.src('build/**/*')
// .pipe(changed(path.build.js, path.build.css))
// .pipe(sftp({
// host: host,
// user: user,
// pass: pass,
// remotePath: remotePath
// }))
// });

gulp.task("default", function (cb) {
run(
"clean",
"build",
"watch",
// 'sass'
"webserver"
, cb);
});

Hello i`m using gulp on my windows 10 pro (clean),

i have sass structure folder (screen)

in folder Blocks i have ~20 scss files.

PC specifications:
Intel core I5 2500k (4cpu) ~3.6Ghz
Ram: 8gb ddr3 1333Mhz
video: gigabyte 1050ti 4gb

at my job i have
Intel i3
~ 4gb ddr3
intel Hd graphics video,

BUT!!! ( ubunut 18 version)
and here gulp working normal

gulp compile first 5 minutes ~200ms (its ok)
after 5 minutes, compile ~5-50s

a year ago i dont have this problem, all were good

gulp ver 3.9.1
node ver 10.10.0
nmp ver 6.4.1

sorry for my English :)
gulp

Does anyone know what the problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant