File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 66 "dev" : " astro dev" ,
77 "build" : " astro build && npx pagefind --site dist" ,
88 "preview" : " astro preview" ,
9- "astro" : " astro"
9+ "astro" : " astro" ,
10+ "convert-gif" : " bash scripts/convert-gif.sh"
1011 },
1112 "dependencies" : {
1213 "@astrojs/mdx" : " ^4.3.13" ,
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -e
3+
4+ echo " Converting GIFs to WebM..."
5+ find public/img -name ' *.gif' -print0 | while IFS= read -r -d ' ' gif; do
6+ webm=" ${gif% .gif} .webm"
7+ echo " $gif -> $webm "
8+ ffmpeg -y -i " $gif " -c:v libvpx-vp9 -crf 30 -b:v 0 " $webm " 2> /dev/null
9+ done
10+
11+ echo " Updating markdown files..."
12+ find src/content -name ' *.md' -exec perl -i -pe '
13+ s/!\[([^\]]*)\]\(([^)]*?)\.gif\)/<video autoplay loop muted playsinline style="max-width:100%">\n <source src="$2.webm" type="video\/webm">\n<\/video>/g
14+ ' {} \;
15+
16+ echo " Removing original GIFs..."
17+ find public/img -name ' *.gif' -delete
18+
19+ echo " Done!"
You can’t perform that action at this time.
0 commit comments