[TASK] update gulp

This commit is contained in:
Christian Seyfferth 2020-05-12 17:46:20 +02:00
parent 590a5212f4
commit 758381e57b
3 changed files with 60 additions and 19 deletions

View File

@ -3,19 +3,12 @@ const {
parallel,
series,
src,
watch,
} = require('gulp');
const newer = require('gulp-newer');
const imagemin = require('gulp-imagemin');
const htmlclean = require('gulp-htmlclean');
const imageResize = require('gulp-image-resize');
const inject = require('gulp-inject');
const uglify = require('gulp-uglify-es').default;
const favicons = require('gulp-favicons');
const sass = require('gulp-sass');
const browserSync = require('browser-sync');
var server = browserSync.create();
const paths = {
scripts: {
@ -42,6 +35,10 @@ const paths = {
src: 'src/img/gallery/*.jpg',
dest: 'dist/img/gallery/thumbs/'
},
images: {
src: 'src/images/*',
dest: 'dist/images/'
},
html: {
src: 'src/*.html',
dest: 'dist/'
@ -51,11 +48,11 @@ const paths = {
dest: 'dist/pdf/'
},
gfx: {
src: 'src/gfx/*.pdf',
src: 'src/gfx/*',
dest: 'dist/gfx/'
},
font: {
src: 'src/font/*.pdf',
src: 'src/font/*',
dest: 'dist/font/'
}
};
@ -65,7 +62,7 @@ const paths = {
function gallery() {
return src(paths.gallery.src)
.pipe(newer(paths.images.dest))
.pipe(newer(paths.gallery.dest))
.pipe(imageResize({
width: 1200,
height: 900,
@ -81,7 +78,7 @@ function gallery() {
removeUselessStrokeAndFill: false
}]
}))
.pipe(dest(paths.images.dest));
.pipe(dest(paths.gallery.dest));
}
function backgrounds() {
@ -102,7 +99,7 @@ function backgrounds() {
removeUselessStrokeAndFill: false
}]
}))
.pipe(dest(paths.images.dest));
.pipe(dest(paths.backgrounds.dest));
}
function thumbnails() {
@ -111,7 +108,7 @@ function thumbnails() {
.pipe(imageResize({
width: 100,
height: 100,
crop: false,
crop: true,
upscale: false
}))
.pipe(imagemin({
@ -144,7 +141,7 @@ function header() {
removeUselessStrokeAndFill: false
}]
}))
.pipe(dest(paths.thumbnails.dest));
.pipe(dest(paths.header.dest));
}
function js() {
@ -155,6 +152,7 @@ function js() {
function css() {
return src(paths.css.src)
.pipe(newer(paths.css.dest))
.pipe(dest(paths.css.dest));
}
@ -167,21 +165,46 @@ function html() {
function pdf() {
return src(paths.pdf.src)
.pipe(newer(paths.pdf.dest))
.pipe(dest(paths.pdf.dest));
}
function gfx() {
return src(paths.gfx.src)
.pipe(newer(paths.gfx.dest))
.pipe(imagemin({
progressive: true,
optimizationLevel: 5,
svgoPlugins: [{
removeViewBox: false
}, {
removeUselessStrokeAndFill: false
}]
}))
.pipe(dest(paths.gfx.dest));
}
function images() {
return src(paths.images.src)
.pipe(newer(paths.images.dest))
.pipe(imagemin({
progressive: true,
optimizationLevel: 5,
svgoPlugins: [{
removeViewBox: false
}, {
removeUselessStrokeAndFill: false
}]
}))
.pipe(dest(paths.images.dest));
}
function font() {
return src(paths.font.src)
.pipe(newer(paths.font.dest))
.pipe(dest(paths.font.dest));
}
function allImages() {
return parallel(gallery, thumbnails, backgrounds, header, gfx);
}
exports.images = allImages;
exports.default = series(parallel(html, pdf, font), js, css, allImages);
exports.scripts = series(js);
exports.images = parallel(gallery, thumbnails, backgrounds, header, gfx, images);
exports.default = series(parallel(html, pdf, font), js, css, parallel(gallery, thumbnails, backgrounds, header, gfx, images));

17
package-lock.json generated
View File

@ -2832,6 +2832,17 @@
}
}
},
"gulp-htmlclean": {
"version": "2.7.22",
"resolved": "https://registry.npmjs.org/gulp-htmlclean/-/gulp-htmlclean-2.7.22.tgz",
"integrity": "sha1-p4Ed6NEiESKuYNZgygFwtltpjd4=",
"dev": true,
"requires": {
"htmlclean": "~3.0.8",
"plugin-error": "^1.0.1",
"through2": "^2.0.3"
}
},
"gulp-image-resize": {
"version": "0.13.1",
"resolved": "https://registry.npmjs.org/gulp-image-resize/-/gulp-image-resize-0.13.1.tgz",
@ -3056,6 +3067,12 @@
"dev": true,
"optional": true
},
"htmlclean": {
"version": "3.0.8",
"resolved": "https://registry.npmjs.org/htmlclean/-/htmlclean-3.0.8.tgz",
"integrity": "sha1-zqRRz1OZ1AGDhqVxKUifLWMOYrA=",
"dev": true
},
"http-cache-semantics": {
"version": "3.8.1",
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz",

View File

@ -6,6 +6,7 @@
"dependencies": {},
"devDependencies": {
"gulp": "^4.0.2",
"gulp-htmlclean": "^2.7.22",
"gulp-image-resize": "^0.13.1",
"gulp-imagemin": "^7.1.0",
"gulp-newer": "^1.4.0",