SHELL := bash .DEFAULT_GOAL := all site ?= $(patsubst %-jekyll-theme,%,$(notdir $(PWD))) domain ?= $(site).sutty.local env ?= production JEKYLL_ENV ?= $(env) include .env export all: fa build ## Todo build: ## Compilar el sitio bundle exec jekyll build --profile --trace serve: /etc/hosts ## Servidor de prueba @echo "Iniciando servidor web" @if ! ss -lnp | grep -q :8080 ; then nghttpd -d _site/ 8080 ../sutty.local/domain/sutty.local.{key,crt} & echo $$! > /tmp/nghttpd.pid ; fi @if ! ss -lnp | grep -q :4000 ; then nghttpx -b "127.0.0.1,9095;/assets/js/" -b "$(domain),8080;/;proto=h2;tls" -f "0.0.0.0,4000" -L FATAL --no-ocsp ../sutty.local/domain/sutty.local.{key,crt} & echo $$! > /tmp/nghttpx.pid ; fi kill-servers: /tmp/nghttpd.pid /tmp/nghttpx.pid /tmp/webpack.pid ## Cerrar el servidor webpack-dev-server: ## Servidor de prueba de Webpack ./node_modules/.bin/webpack-dev-server --public $(domain):9095 & echo $$! > /tmp/webpack.pid # Tomar los códigos de los íconos de este archivo y copiarlos a fa.txt # node_modules/font-awesome/scss/_variables.scss whitelist = $(shell grep -v "^#" fa.txt | sed "s/^/U+/" | tr "\n" ",") assets/fonts/forkawesome-webfont.woff2: fa.txt which glyphhanger || npm i -g glyphhanger glyphhanger --subset=node_modules/fork-awesome/fonts/forkawesome-webfont.ttf --formats=woff2 --whitelist=$(whitelist) mv node_modules/fork-awesome/fonts/forkawesome-webfont-subset.woff2 $@ fa: assets/fonts/forkawesome-webfont.woff2 ## Fork Awesome /etc/hosts: always @echo "Chequeando si es necesario agregar el dominio local $(domain)" @grep -q " $(domain)$$" $@ || echo -e "127.0.0.1 $(domain)\n::1 $(domain)" | sudo tee -a $@ %.pid: always @test -f $@ && cat $@ | xargs -r kill &>/dev/null || : @rm -f $@ .PHONY: always