SHELL := bash .DEFAULT_GOAL := help site ?= $(patsubst %-jekyll-theme,%,$(notdir $(PWD))) domain ?= $(site).sutty.local env ?= development hainish ?= ../haini.sh/haini.sh hain ?= ../hain JEKYLL_ENV := $(env) .env: @touch .env include .env export help: always ## Ayuda @grep "^[^\t]\+:.*##" Makefile | sed -re "s/(.*):.*##(.*)/\1;\2/" | column -s ";" -t | sed -re "s/^([^ ]+) /\x1B[38;5;197m\1\x1B[0m/" all: node_modules fa install serve build ## Todas las tareas necesarias para desarrollar install: node_modules Gemfile.lock ## Instalar las dependencias build: ## Compilar el sitio make bundle args="exec jekyll build --profile --trace" @echo -e "\a" bundle: ## Correr comandos con bundler (args="install") $(hainish) 'bundle $(args)' serve: /etc/hosts $(hain)/run/nginx/nginx.pid ## Servidor de desarrollo @echo "Iniciado servidor web en https://$(domain):4000/" webpack: assets/js/pack.js ## Compilar JS @echo -e "\a" webpack-dev-server: /tmp/webpack.pid ## Servidor de prueba de Webpack fa: assets/fonts/forkawesome-webfont.woff2 ## Fork Awesome @echo -e "\a" 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 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/ node_modules: package.json $(hainish) yarn Gemfile.lock: Gemfile $(hainish) 'bundle install' $(hain)/run/nginx/nginx.pid: $(hainish) nginx /tmp/webpack.pid: $(hainish) ./node_modules/.bin/webpack-dev-server --public $(domain):4000 --host 127.0.0.1 --port 65001 & echo $$! > /tmp/webpack.pid /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 $@ js = $(wildcard _packs/*.js) $(wildcard _packs/*/*.js) $(wildcard *.js) assets/js/pack.js: $(js) $(hainish) ./node_modules/.bin/webpack --config webpack.prod.js # 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 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 $@ .PHONY: always