From 99545a988b26c88cfc75d341107a1c8ce0ae3c60 Mon Sep 17 00:00:00 2001 From: Patrick Neff Date: Tue, 8 Jan 2019 23:42:05 +0100 Subject: [PATCH] Add Makefile --- Makefile | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5b0e79f --- /dev/null +++ b/Makefile @@ -0,0 +1,41 @@ +THEME = neff +REMOTE = dev.test:/var/www/neff-steindesign.dev.test + +HUGO = /usr/bin/hugo +NPM = /usr/bin/npm +RSYNC = /usr/bin/rsync +JPEGOPTIM = /usr/bin/jpegoptim +OPTIPNG = /usr/bin/optipng + +.PHONY = all clean server + +DIRS = content data static themes/$(THEME) resources + +JPEG = $(wildcard *.jpg) +PNG = $(wildcard *.png) + +all: $(JPEG) $(PNG) $(DIRS) public/* + +clean: + rm -rf public/ resources/ + +server: themes/$(THEME)/package-lock.json themes/$(THEME)/src + $(HUGO) server --buildDrafts --buildExpired --buildFuture --gc + +$(JPEG): + $(JPEGOPTIM) --max=75 $? + +$(PNG): + $(OPTIPNG) -preserve -quiet -- $? + +$(DIRS): themes/$(THEME)/package-lock.json themes/$(THEME)/src + $(HUGO) --gc + +themes/$(THEME)/package-lock.json: + $(NPM) --prefix="themes/$(THEME)" install --save-dev + +themes/$(THEME)/src: + $(NPM) --prefix="themes/$(THEME)" run build + +public/*: + $(RSYNC) -avz --delete public/ $(REMOTE) \ No newline at end of file