svg.escobar.life

A simple SVG markup editor for the web

Commit
8c02e98c131ded8fac6a90fba2afa1803e9ad39b
Parent
c06179370421a64ca339967310daff4b649c2731
Author
Pablo Emilio Escobar Gaviria <pablo-escobar@riseup.net>
Date

Added line in Makefile to compress the output of `elm make`

Diffstat

3 files changed, 16 insertions, 16 deletions

Status File Name N° Changes Insertions Deletions
Modified Makefile 7 5 2
Modified admin-tools/d-fold.py 5 1 4
Modified index.html 20 10 10
diff --git a/Makefile b/Makefile
@@ -4,9 +4,12 @@ runserver:
 	(cd _site && python3 -m http.server)
 
 build:
-	elm make --optimize --output=_site/js/script.min.js src/Main.elm
+	elm make --optimize --output=/tmp/elm-script.js src/Main.elm
+	uglifyjs --compress --mangle -o _site/js/script.min.js -- /tmp/elm-script.js
+	rm /tmp/elm-script.js
 	cp index.html css assets _site/ -r
 	cp js/* _site/js/
 
 auto-compile:
-	ls src/*.elm js/* css/* assets/* index.html | entr make build
+	ls src/*.elm js/* css/* assets/* index.html Makefile | entr make build
+
diff --git a/admin-tools/d-fold.py b/admin-tools/d-fold.py
@@ -50,12 +50,9 @@ def main():
 
     with open(path, "r") as f:
         s = f.read().replace("\n", "")
-
-        # Lines separated by spaces with at-most 50 chars
-        spaced_lines = split_at(s, args.chars)
         lines = []
 
-        for line in spaced_lines:
+        for line in split_at(s, args.chars):
             if len(line) <= args.chars:
                 lines.append(line)
             else:
diff --git a/index.html b/index.html
@@ -14,17 +14,17 @@
   <script src="js/script.min.js"></script>
 </head>
 <body>
-	<script>Elm.Main.init()</script>
-  <script>
-      function load() {
-          navigator.serviceWorker
-              .register('./service-worker.js')
-              .then(console.log)
-              .catch(console.error);
-      }
+	<script>
+    Elm.Main.init();
 
-      if ('serviceWorker' in navigator)
-          window.addEventListener('load', load);
+    function load() {
+      navigator.serviceWorker
+        .register("./service-worker.js")
+        .then(console.log)
+        .catch(console.error);
+    }
+
+    if ("serviceWorker" in navigator) window.addEventListener("load", load);
   </script>
   <noscript>
     <header id="noscript">