From 210a49413f6ef6e87ec5657548b34c975ac1d806 Mon Sep 17 00:00:00 2001
From: Janne Koschinski <janne@kuschku.de>
Date: Tue, 6 Mar 2018 15:41:13 +0100
Subject: [PATCH] Improved assets

---
 Makefile                        |  6 ++++++
 assets/css/Makefile             | 14 ++++++-------
 assets/css/generate_makefile.sh | 36 ---------------------------------
 package.json                    |  6 +++---
 4 files changed, 15 insertions(+), 47 deletions(-)
 create mode 100644 Makefile
 delete mode 100755 assets/css/generate_makefile.sh

diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..0f7c8a2
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,6 @@
+PUG = $(shell pwd)/node_modules/pug-cli/index.js --basedir .
+
+all: index.html privacy-policy/index.html releases/index.html
+
+%.html: %.pug
+	$(PUG) $<
diff --git a/assets/css/Makefile b/assets/css/Makefile
index 2c52408..d943d6b 100644
--- a/assets/css/Makefile
+++ b/assets/css/Makefile
@@ -1,10 +1,8 @@
 SASS = $(shell pwd)/../../node_modules/node-sass/bin/node-sass --output-style compressed
+
 all: fonts.css style.css important.css semantic.css
-fonts.css: fonts.sass
-	$(SASS) fonts.sass -o .
-style.css: style.sass
-	$(SASS) style.sass -o .
-important.css: important.scss
-	$(SASS) important.scss -o .
-semantic.css: semantic.scss
-	$(SASS) semantic.scss -o .
+
+%.css: %.sass
+	$(SASS) $< -o .
+%.css: %.scss
+	$(SASS) $< -o .
diff --git a/assets/css/generate_makefile.sh b/assets/css/generate_makefile.sh
deleted file mode 100755
index c82f4a3..0000000
--- a/assets/css/generate_makefile.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/bash
-
-cd $(dirname $(realpath -s ${0}))
-
-RULES=()
-
-function generate_rule() {
-  file=${1}
-  filename=${2}
-
-  RULES+=("${filename}.css")
-  echo "${filename}.css: ${file}" >> Makefile.wip
-  echo "	\$(SASS) ${file} -o ." >> Makefile.wip
-}
-
-function finalize() {
-  echo -n "all:" >> Makefile
-  for rule in "${RULES[@]}"; do
-    echo -n " $rule" >> Makefile
-  done
-  echo >> Makefile
-  cat Makefile.wip >> Makefile
-  rm Makefile.wip
-}
-
-cat <<EOF > Makefile
-SASS = \$(shell pwd)/../../node_modules/node-sass/bin/node-sass --output-style compressed
-EOF
-for file in *.sass; do
-  generate_rule ${file} ${file%.*}
-done
-for file in *.scss; do
-  generate_rule ${file} ${file%.*}
-done
-
-finalize
\ No newline at end of file
diff --git a/package.json b/package.json
index 6844649..278475a 100644
--- a/package.json
+++ b/package.json
@@ -3,9 +3,9 @@
   "version": "3.0.0",
   "description": "This is a websearch frontend for a quassel database.",
   "scripts": {
-    "pug": "node_modules/pug-cli/index.js --basedir . **/index.pug index.pug",
-    "sass": "assets/css/generate_makefile.sh  && cd assets/css && make",
-    "images": "assets/images/generate_makefile.sh && cd assets/images && make",
+    "pug": "make -j8",
+    "sass": "cd assets/css && make -j8",
+    "images": "assets/images/generate_makefile.sh && cd assets/images && make -j8",
     "build": "npm run images && npm run sass && npm run pug"
   },
   "author": "Janne Koschinski",
-- 
GitLab