Skip to content

Commit 9aadd81

Browse files
Merge pull request #16 from thibaultduponchelle/auto-generate-exports
Auto generate exports
2 parents 4cb2833 + 936fce5 commit 9aadd81

File tree

9 files changed

+44
-0
lines changed

9 files changed

+44
-0
lines changed

.github/workflows/generate.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Generate all assets
2+
3+
on:
4+
push:
5+
branches: main
6+
7+
jobs:
8+
generate:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Install prerequisites
14+
run: |
15+
npm i svgo
16+
sudo apt-get install -y librsvg2-bin
17+
18+
- name: Clean exports directory
19+
run: |
20+
git rm blessed/exports/*.svg || true
21+
git rm blessed/exports/*.png || true
22+
23+
- name: Generate all sizes in SVG and PNG
24+
run:
25+
bash generate.sh
26+
27+
- name: Optimize SVGs
28+
run:
29+
./node_modules/.bin/svgo --pretty blessed/exports/*.svg
30+
31+
- name: Commit and push blessed/exports
32+
run: |
33+
git config --global user.name "Assets Generator"
34+
git config --global user.email "[email protected]"
35+
git add blessed/exports
36+
git commit -m "Generate several sizes in SVG and PNG" || true
37+
git push || true

blessed/exports/.gitkeep

Whitespace-only changes.

blessed/exports/010.png

-535 KB
Binary file not shown.

blessed/exports/030.png

-728 KB
Binary file not shown.

blessed/exports/031.png

-166 KB
Binary file not shown.

blessed/exports/032.png

-134 KB
Binary file not shown.

blessed/exports/033.png

-167 KB
Binary file not shown.

blessed/exports/080.png

-944 KB
Binary file not shown.

generate.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
cd blessed/src/
2+
for f in `ls *.svg | sed s/\.svg//g`; do
3+
for s in 64 300 800 1500 2500; do
4+
rsvg-convert -f svg -w $s $f.svg > ../exports/perl-$f-$s.svg;
5+
rsvg-convert -f png -w $s $f.svg > ../exports/perl-$f-$s.png;
6+
done
7+
done

0 commit comments

Comments
 (0)