descargar, actualizar y optimizar tipografías de google fonts

This commit is contained in:
f 2021-05-08 20:15:58 -03:00
parent f8822dc10d
commit b69cac3c99
3 changed files with 18 additions and 1 deletions

2
.gitignore vendored
View file

@ -13,3 +13,5 @@ _site
Gemfile.lock Gemfile.lock
node_modules/ node_modules/
.env .env
*.ttf
*.otf

View file

@ -22,7 +22,7 @@ all: node_modules fa install serve build ## Todas las tareas necesarias para des
install: node_modules Gemfile.lock ## Instalar las dependencias install: node_modules Gemfile.lock ## Instalar las dependencias
build: ## Compilar el sitio build: ## Compilar el sitio (env=production)
make bundle args="exec jekyll build --profile --trace" make bundle args="exec jekyll build --profile --trace"
@echo -e "\a" @echo -e "\a"
@ -44,6 +44,13 @@ fa-%: always ## Agregar un ícono de Fork Awesome (reemplazar % por el nombre)
@echo Agregando $* a la lista de íconos @echo Agregando $* a la lista de íconos
@grep -q "$*" fa.txt || grep '^$$fa-var-$*: ' node_modules/fork-awesome/scss/_variables.scss | sed -re "s/^.*: \"\\\(.*)\";/\1 $*/" >> fa.txt @grep -q "$*" fa.txt || grep '^$$fa-var-$*: ' node_modules/fork-awesome/scss/_variables.scss | sed -re "s/^.*: \"\\\(.*)\";/\1 $*/" >> fa.txt
gfont: ## Descarga tipografías de Google Fonts (css="url del css")
@test -n "$(css)"
wget "$(css)" -nv -kO /tmp/gfont
cd assets/fonts/ && grep -Eo "https://[^\"')]+" /tmp/gfont | sort -u | wget -i - -x -nH -nv --cut-dir 1 -N
grep -q "$(css)" _sass/fonts.scss || sed -r -e "1i // $(css)" -e "s,https://fonts\.gstatic\.com/s/,../fonts/," -e "s/\.[to]tf/-subset.woff2/g" -e "s/(true|open)type/woff2/g" /tmp/gfont >> _sass/fonts.scss
find assets/fonts/ -name "*.?tf" | sed -re "s/\.[ot]tf/-subset.woff2/" | xargs make
push: ## Publica los cambios locales push: ## Publica los cambios locales
sudo chgrp -R 82 _site sudo chgrp -R 82 _site
rsync -avi --delete-after _site/ root@athshe.sutty.nl:/srv/sutty/srv/http/data/_deploy/$(site).sutty.nl/ rsync -avi --delete-after _site/ root@athshe.sutty.nl:/srv/sutty/srv/http/data/_deploy/$(site).sutty.nl/
@ -74,4 +81,12 @@ assets/fonts/forkawesome-webfont.woff2: fa.txt
grep -v "^#" fa.txt | sed "s/^/U+/" | cut -d " " -f 1 | tr "\n" "," | xargs -rI {} glyphhanger --subset=node_modules/fork-awesome/fonts/forkawesome-webfont.ttf --formats=woff2 --whitelist="{}" grep -v "^#" fa.txt | sed "s/^/U+/" | cut -d " " -f 1 | tr "\n" "," | xargs -rI {} glyphhanger --subset=node_modules/fork-awesome/fonts/forkawesome-webfont.ttf --formats=woff2 --whitelist="{}"
mv node_modules/fork-awesome/fonts/forkawesome-webfont-subset.woff2 $@ mv node_modules/fork-awesome/fonts/forkawesome-webfont-subset.woff2 $@
# Generar woff2 reducidas al alfabeto latino
%-subset.woff2: %.ttf
glyphhanger --subset=$< --formats=woff2 --LATIN
# Generar woff2 reducidas al alfabeto latino
%-subset.woff2: %.otf
glyphhanger --subset=$< --formats=woff2 --LATIN
.PHONY: always .PHONY: always

0
_sass/fonts.scss Normal file
View file