Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 34 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ const source = require('vinyl-source-stream');
const plumber = require('gulp-plumber');
const notifier = require('node-notifier');
const {build} = require('esbuild')
const imagemin = require('gulp-imagemin');
const pngquant = require('imagemin-pngquant');


//Pathes
var path = {
src: 'app/src',
css: 'app/src/css',
scss: 'app/src/scss',
js: 'app/src/js',
Expand Down Expand Up @@ -91,10 +94,11 @@ function serve(done) {
}

function watchFiles(done) {
watch(path.scss + '/*.scss', series(cleanDev, scss, buildCSS));
watch(path.scss + '/**/*.scss', series(cleanDev, scss, buildCSS));
watch([path.js + '/**/*.js'], series(buildJS));

watch("app/*.html").on('change', reload);
watch([path.src + '/**/*.html'], series(copyHtml));

watch("app/**/*.html").on('change', reload);
done();
}

Expand All @@ -106,5 +110,32 @@ function notify(done) {
done()
}



function compressImg() {
return src(path.images + '/**/*')
.pipe(imagemin({
progressive: true,
optimizationLevel: 7,
svgoPlugins: [{
removeViewBox: false
}],
use: [pngquant()]
}))
.pipe(dest(path.production + '/img'));
}

function copyFonts() {
return src(path.fonts + '/**/*')
.pipe(dest(path.production + "/fonts"));
}

function copyHtml() {
return src(path.src + '/**/*.html')
.pipe(dest(path.production));
}

exports.default = series(cleanDev, scss, buildCSS);
exports.dev = series(cleanDev, scss, buildCSS, buildJS, watchFiles, notify, serve);

exports.BuildProd = series(cleanFull, scss, buildCSS, buildJS, compressImg, copyFonts, copyHtml);
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"main": "index.html",
"scripts": {
"dev": "gulp dev",
"prod": "gulp BuildProd",
"esbuild": "esbuild --bundle app/src/js/index.js"
},
"repository": {
Expand All @@ -27,10 +28,12 @@
"del": "^5.1.0",
"esbuild": "^0.3.5",
"gulp": "^4.0.2",
"gulp-imagemin": "^7.1.0",
"gulp-notify": "^3.2.0",
"gulp-plumber": "^1.2.1",
"gulp-postcss": "^8.0.0",
"gulp-sass": "^4.1.0",
"imagemin-pngquant": "^9.0.2",
"node-notifier": "^7.0.0",
"node-sass": "^4.14.1",
"postcss-preset-env": "^6.7.0",
Expand Down