Optimize gifs

This commit is contained in:
Maria Rushkova 2021-08-05 17:27:46 +02:00
parent 370ebd4e0e
commit a1649b40e1
8 changed files with 5967 additions and 41 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 868 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 MiB

After

Width:  |  Height:  |  Size: 705 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 989 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 MiB

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

After

Width:  |  Height:  |  Size: 82 KiB

View File

@ -5,11 +5,14 @@ import cssnano from "cssnano";
import { dest, series, src, task, watch } from "gulp";
import postcss from "gulp-postcss";
import atimport from "postcss-import";
import imagemin from "gulp-imagemin";
import tailwindcss from "tailwindcss";
const SITE_ROOT = "./_site";
const POST_BUILD_STYLESHEET = `${SITE_ROOT}/assets/css/`;
const PRE_BUILD_STYLESHEET = "./assets/css/style.css";
const IMAGES = "./assets/img";
const IMAGES_MINIMIZED = `${SITE_ROOT}/assets/`;
const TAILWIND_CONFIG = "./tailwind.config.js";
// Fix for Windows compatibility
@ -43,6 +46,19 @@ task("processStyles", () => {
.pipe(dest(POST_BUILD_STYLESHEET));
});
task("images", () => {
return src(IMAGES)
.pipe(
imagemin([
imagemin.gifsicle({ interlaced: true }),
imagemin.optipng({ optimizationLevel: 3 }),
imagemin.svgo(),
])
)
.pipe(dest(IMAGES_MINIMIZED));
});
task("startServer", () => {
browserSync.init({
files: [SITE_ROOT + "/**"],
@ -71,7 +87,7 @@ task("startServer", () => {
);
});
const buildSite = series("buildJekyll", "processStyles");
const buildSite = series("buildJekyll", "processStyles", "images");
exports.serve = series(buildSite, "startServer");
exports.default = series(buildSite);

5989
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -11,6 +11,7 @@
"cross-spawn": "7.0.3",
"cssnano": "5.0.7",
"gulp": "4.0.2",
"gulp-imagemin": "^7.1.0",
"gulp-postcss": "9.0.0",
"postcss": "8.3.6",
"postcss-import": "14.0.2",