diff --git a/Makefile b/Makefile index 90e4c79..e804cec 100644 --- a/Makefile +++ b/Makefile @@ -39,8 +39,9 @@ PANDOC := pandoc \ --standalone $(DST_DIR)/%.html: $(SRC_DIR)/%.org $(TEMPLATE) @mkdir -p $(dir $@) - $(PANDOC) $< \ - --output $@ + $(PANDOC) $< --output $@.tmp + minify --mime text/html $@.tmp > $@ + @rm $@.tmp ALL += $(DST_PANDOC_FILES) # HTML INDEX @@ -51,6 +52,13 @@ $(HTML_INDEX): $(DST_PANDOC_FILES) $(MKINDEX) $(MKINDEX) ALL += $(HTML_INDEX) +# RSS +RSS := $(DST_DIR)/rss.xml +MKRSS := engine/mkrss.sh +$(RSS): $(DST_PANDOC_FILES) $(MKRSS) + $(MKRSS) +ALL += $(RSS) + # ORG -> GEMINI EXT := .org SRC_GMI_FILES ?= $(shell find $(SRC_DIR) -type f -name "*$(EXT)" $(NO_DRAFT)) @@ -71,7 +79,12 @@ $(GMI_INDEX): $(DST_GMI_FILES) $(MK_GMI_INDEX) $(MK_GMI_INDEX) ALL += $(GMI_INDEX) - +# RSS +GEM_ATOM := $(DST_DIR)/gem-atom.xml +MK_GEMINI_ATOM := engine/mk-gemini-atom.sh +$(GEM_ATOM): $(DST_GMI_FILES) $(MK_GEMINI_ATOM) + $(MK_GEMINI_ATOM) +ALL += $(GEM_ATOM) # Images SRC_IMG_FILES ?= $(shell find $(SRC_DIR) -type f -name "*.jpg" -or -name "*.jpeg" -or -name "*.gif" -or -name "*.png") @@ -94,23 +107,9 @@ $(DST_DIR)/%.png: $(SRC_DIR)/%.png convert "$<" -quality 50 -resize 800x800\> "$@" ALL += $(DST_IMG_FILES) - -# OPTIM PHASE - -OPTIM_DIR ?= _optim -ENGINE_DIR ?= engine -ENGINE_SCRIPTS := $(shell find $(ENGINE_DIR) -type f) -OPTIM := engine/pre-deploy.sh -$(OPTIM_DIR)/index.html:$(DST_RAW_FILES) $(DST_GMI_FILES) $(DST_PANDOC_FILES) $(HTML_INDEX) $(ENGINE_SCRIPTS) $(OPTIM) - @mkdir -p $(OPTIM_DIR) - $(OPTIM) - -optim: $(OPTIM_DIR)/index.html - - # DEPLOY -deploy: $(OPTIM_DIR)/index.html +deploy: $(ALL) engine/sync.sh # deploy to her.esy.fun engine/ye-com-fastpublish.hs # deploy to yannesposito.com (via github pages) @@ -119,5 +118,4 @@ fast: $(ALL) .PHONY: clean clean: - -rm -rf $(DST_DIR)/* - -rm -rf $(OPTIM_DIR)/* + -[ ! -z "$(DST_DIR)" ] && rm -rf $(DST_DIR)/* diff --git a/engine/auto-build.sh b/engine/auto-build.sh index 6c9f4e6..4517daf 100755 --- a/engine/auto-build.sh +++ b/engine/auto-build.sh @@ -5,5 +5,5 @@ echo "Watching $PWD/{src,templates}" # fswatch --exclude='\\.#' src | while read event; do fswatch --exclude='^.*\.#.*$' src templates | while read event; do echo "$event" - make + ./engine/build.sh done diff --git a/engine/build.sh b/engine/build.sh index f18811f..274b2dc 100755 --- a/engine/build.sh +++ b/engine/build.sh @@ -1,4 +1,4 @@ #!/bin/zsh cd "$(git rev-parse --show-toplevel)" || exit 1 -make +make -j $(getconf _NPROCESSORS_ONLN) diff --git a/engine/mk-gemini-atom.sh b/engine/mk-gemini-atom.sh index 438c12b..4ea7925 100755 --- a/engine/mk-gemini-atom.sh +++ b/engine/mk-gemini-atom.sh @@ -2,7 +2,7 @@ cd "$(git rev-parse --show-toplevel)" || exit 1 # Directory -webdir="_optim" +webdir="_site" postsdir="$webdir/posts" rssfile="$webdir/gem-atom.xml" diff --git a/engine/mkrss.sh b/engine/mkrss.sh index 7589733..8a8bcbf 100755 --- a/engine/mkrss.sh +++ b/engine/mkrss.sh @@ -2,7 +2,7 @@ cd "$(git rev-parse --show-toplevel)" || exit 1 # Directory -webdir="_optim" +webdir="_site" postsdir="$webdir/posts" rssfile="$webdir/rss.xml" diff --git a/engine/sync.sh b/engine/sync.sh index b5f27c2..d17bba0 100755 --- a/engine/sync.sh +++ b/engine/sync.sh @@ -1,7 +1,7 @@ #!/usr/bin/env zsh cd "$(git rev-parse --show-toplevel)" || exit 1 -webdir="_optim" +webdir="_site" [[ -d $webdir ]] || { echo "no $webdir directory"; exit 1 } @@ -9,5 +9,6 @@ echo -n "Uploading website" rsync --progress\ --partial \ --delete \ + --exclude '.git' \ -avHe ssh ${webdir}/ root@esy.fun:/var/www/her.esy.fun/ echo " [done]" diff --git a/engine/ye-com-fastpublish.hs b/engine/ye-com-fastpublish.hs index c46ff8f..05cc289 100755 --- a/engine/ye-com-fastpublish.hs +++ b/engine/ye-com-fastpublish.hs @@ -67,7 +67,7 @@ checkDir = do toolsExists <- testdir "engine" if (not toolsExists) then exit (ExitFailure 1) - else return "_optim" + else return "_site" mainRepository = "git@github.com:yogsototh/yannesposito.com.git"