From b69cac3c99941baa1a2abcd1edc2dca9b4b8aeb2 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 8 May 2021 20:15:58 -0300 Subject: [PATCH] =?UTF-8?q?descargar,=20actualizar=20y=20optimizar=20tipog?= =?UTF-8?q?raf=C3=ADas=20de=20google=20fonts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 ++ Makefile | 17 ++++++++++++++++- _sass/fonts.scss | 0 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 _sass/fonts.scss diff --git a/.gitignore b/.gitignore index d68cd18..6ece273 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,5 @@ _site Gemfile.lock node_modules/ .env +*.ttf +*.otf diff --git a/Makefile b/Makefile index 10a6ab0..4f0b521 100644 --- a/Makefile +++ b/Makefile @@ -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 -build: ## Compilar el sitio +build: ## Compilar el sitio (env=production) make bundle args="exec jekyll build --profile --trace" @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 @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 sudo chgrp -R 82 _site 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="{}" 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 diff --git a/_sass/fonts.scss b/_sass/fonts.scss new file mode 100644 index 0000000..e69de29