sutty-base-jekyll-theme/Makefile

56 lines
2.1 KiB
Makefile
Raw Normal View History

2020-11-12 16:28:24 +00:00
SHELL := bash
2020-06-17 19:58:05 +00:00
.DEFAULT_GOAL := all
2020-11-12 16:28:24 +00:00
site ?= $(patsubst %-jekyll-theme,%,$(notdir $(PWD)))
domain ?= $(site).sutty.local
env ?= production
JEKYLL_ENV ?= $(env)
include .env
2020-06-17 19:58:05 +00:00
export
2020-11-12 16:28:24 +00:00
all: fa build ## Todo
2020-06-17 19:58:05 +00:00
2020-11-12 16:28:24 +00:00
build: ## Compilar el sitio
2020-06-17 19:58:05 +00:00
bundle exec jekyll build --profile --trace
2020-11-12 16:28:24 +00:00
serve: /etc/hosts ## Servidor de prueba
@echo "Iniciando servidor web"
@if ! ss -lnp | grep -q :65000 ; then nghttpd -d _site/ 65000 ../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,65001;/assets/js/:/sockjs-node/" -b "$(domain),65000;/;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
2020-11-12 16:28:24 +00:00
kill-servers: /tmp/nghttpd.pid /tmp/nghttpx.pid /tmp/webpack.pid ## Cerrar el servidor
2020-11-12 17:42:00 +00:00
webpack: assets/js/pack.js ## Compilar JS
2020-11-12 16:28:24 +00:00
webpack-dev-server: ## Servidor de prueba de Webpack
./node_modules/.bin/webpack-dev-server --public $(domain):4000 --host 127.0.0.1 --port 65001 & echo $$! > /tmp/webpack.pid
2020-06-17 19:58:05 +00:00
# Tomar los códigos de los íconos de este archivo y copiarlos a fa.txt
# node_modules/font-awesome/scss/_variables.scss
assets/fonts/forkawesome-webfont.woff2: fa.txt
which glyphhanger || npm i -g glyphhanger
2020-11-12 19:04:36 +00:00
grep -v "^#" fa.txt | sed "s/^/U+/" | tr "\n" "," | xargs -rI {} glyphhanger --subset=node_modules/fork-awesome/fonts/forkawesome-webfont.ttf --formats=woff2 --whitelist="{}"
2020-06-17 19:58:05 +00:00
mv node_modules/fork-awesome/fonts/forkawesome-webfont-subset.woff2 $@
2020-11-12 16:28:24 +00:00
fa: assets/fonts/forkawesome-webfont.woff2 ## Fork Awesome
2020-11-12 18:03:43 +00:00
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/
2020-11-12 16:28:24 +00:00
/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 $@
2020-11-12 17:42:00 +00:00
js = $(wildcard _packs/*.js) $(wildcard _packs/*/*.js)
assets/js/pack.js: $(js)
./node_modules/.bin/webpack --config webpack.prod.js
2020-11-12 16:28:24 +00:00
.PHONY: always