Verified Commit e09e7d54 authored by Jelle van der Waa's avatar Jelle van der Waa 🚧
Browse files

Add svgcleaner step for svg minification

Reduce the size of the svg on build with ~ 50% by using svgcleaner.
parent d569d645
Pipeline #2637 passed with stage
in 37 seconds
...@@ -2,7 +2,7 @@ image: "archlinux:latest" ...@@ -2,7 +2,7 @@ image: "archlinux:latest"
dist: dist:
script: script:
- pacman -Syu --needed --noconfirm yarn ruby-sass make git - pacman -Syu --needed --noconfirm yarn ruby-sass make git svgcleaner
- make - make
- make dist - make dist
after_script: after_script:
......
...@@ -11,6 +11,7 @@ PORT ?= 9966 ...@@ -11,6 +11,7 @@ PORT ?= 9966
HOST ?= localhost HOST ?= localhost
VERSION ?= $(shell git describe --tags --always --dirty --match=v* 2>/dev/null | sed 's/^v//' || \ VERSION ?= $(shell git describe --tags --always --dirty --match=v* 2>/dev/null | sed 's/^v//' || \
cat $(CURDIR)/.version 2> /dev/null || echo 0.0.0-unreleased) cat $(CURDIR)/.version 2> /dev/null || echo 0.0.0-unreleased)
ARCHLOGO = public/archlogo.8a05bc7f6cd1.svg
all: vendor all: vendor
...@@ -33,7 +34,8 @@ dist: vendor ...@@ -33,7 +34,8 @@ dist: vendor
@mkdir -p "dist/${PACKAGE_NAME}-${VERSION}" @mkdir -p "dist/${PACKAGE_NAME}-${VERSION}"
cp -avf public/index.html "dist/${PACKAGE_NAME}-${VERSION}/index.html" cp -avf public/index.html "dist/${PACKAGE_NAME}-${VERSION}/index.html"
# TODO: cache-invalidation with version string replaced in html file # TODO: cache-invalidation with version string replaced in html file
cp -Lvf public/favicon.ico public/*.svg -t "dist/${PACKAGE_NAME}-${VERSION}/" svgcleaner ${ARCHLOGO} "$dist/${PACKAGE_NAME}-${VERSION}/${ARCHLOGO}"
cp -vf public/favicon.ico -t "dist/${PACKAGE_NAME}-${VERSION}/"
$(SASS) -t compressed src/style.scss "dist/${PACKAGE_NAME}-${VERSION}/bundle.css" $(SASS) -t compressed src/style.scss "dist/${PACKAGE_NAME}-${VERSION}/bundle.css"
$(YARN) run -s browserify -t babelify src/index.js | $(YARN) run -s terser --compress --mangle > "dist/${PACKAGE_NAME}-${VERSION}/bundle.js" $(YARN) run -s browserify -t babelify src/index.js | $(YARN) run -s terser --compress --mangle > "dist/${PACKAGE_NAME}-${VERSION}/bundle.js"
cd dist && tar --owner=0 --group=0 -czvf ${PACKAGE_NAME}-${VERSION}.tar.gz "${PACKAGE_NAME}-${VERSION}" cd dist && tar --owner=0 --group=0 -czvf ${PACKAGE_NAME}-${VERSION}.tar.gz "${PACKAGE_NAME}-${VERSION}"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment