Kaynağa Gözat

Add Makefile to create a live distribution

Creates a version of the site with concatenated assets, for a more
optimized live site. Done with `make` to keep things simple and
low-dependency.
Weiyi Lou 9 yıl önce
ebeveyn
işleme
bac25e055b
6 değiştirilmiş dosya ile 66 ekleme ve 29 silme
  1. 1 0
      .gitignore
  2. 24 0
      Makefile
  3. 24 2
      README.md
  4. 0 9
      TODO.md
  5. 3 0
      css/app.css
  6. 14 18
      index.html

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+dist/

+ 24 - 0
Makefile

@@ -0,0 +1,24 @@
+# Title
+
+# Auto-Documenting Section. Displays a target list with `##` descriptions.
+help:
+	@grep -E '^[a-zA-Z_-]+:.*## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "%-15s %s\n", $$1, $$2}'
+.PHONY: help dist
+
+dist: ## Create a distribution for live usage
+	@mkdir -p dist/{css,js,tags}
+	@echo "combining css"
+	@cat css/vendor/* > dist/css/app.css
+	@cat css/style.css >> dist/css/app.css
+	@echo "combining javascript"
+	@cat js/vendor/* > dist/js/app.js
+	@cat js/pgsh.js >> dist/js/app.js
+	@echo "copying riot tags"
+	@cp tags/*.tag dist/tags/
+	@echo "adjusting index.html"
+	@sed "/$(JS_TAGS)/D" index.html | sed "s|$(APPJS_PH)|$(APPJS_TAG)|" > dist/index.html
+	@echo "all done!"
+
+JS_TAGS = <script.*type='text\/javascript'
+APPJS_PH = <!-- appjsplaceholder -->
+APPJS_TAG = <script type='text/javascript' src='js/app.js'><\/script>

+ 24 - 2
README.md

@@ -2,7 +2,29 @@
 
 It is really just the main website of [parsleygardens.net][].
 
-Built with [Riot.js][].
+Built with:
+
+- [Riot.js][]
+- [Skeleton][]
+- [Highlight.js][].
 
 [parsleygardens.net]: http://www.parsleygardens.net
-[Riot.js]: http://riotjs.com/
+[Riot.js]: http://riotjs.com
+[Skeleton]: https://skeleton-framework.github.io
+[highlight.js]: https://highlightjs.org
+
+## Develop
+
+`riot` compilation happens in the browser, so viewing the app is a matter of
+opening `index.html`:
+
+    $ open index.html
+
+## Build
+
+A distribution of the app can be built that will concatenate assets and modify
+`index.html` to minimize HTTP requests:
+
+    $ make dist
+
+This creates `dist/`, which can be copied to a live webserver.

+ 0 - 9
TODO.md

@@ -1,9 +0,0 @@
-# TODO
-
-- Partial 'readline' support with `onkeypress`/`onkeydown`?
-  - `<C-a>`, `<C-e>`, `<C-w>`(?), up, down
-  - Should we attempt `<C-z>` for Suspend mode?
-- Prompt disable/keystroke pass-through to shell
-  - e.g. can you maybe make a rogue like?
-- Display partial redraw, or give more fine-grain display access?
-  - split all display items into lines?

+ 3 - 0
css/app.css

@@ -0,0 +1,3 @@
+@import 'vendor/skeleton.min.css';
+@import 'vendor/solarized-dark.css';
+@import 'style.css';

+ 14 - 18
index.html

@@ -1,24 +1,20 @@
 <!DOCTYPE html>
 <html>
   <head>
-    <meta charset="utf-8">
-    <meta http-equiv="X-UA-Compatible" content="IE=edge">
-    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <meta charset='utf-8'>
+    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
+    <meta name='viewport' content='width=device-width, initial-scale=1'>
 
     <title>pgsh</title>
-    <meta name="description" content="The Parsley Gardens Website!">
-    <meta name="author" content="Weiyi Lou">
+    <meta name='description' content='The Parsley Gardens Website!'>
+    <meta name='author' content='Weiyi Lou'>
 
-    <!-- CSS
-    –––––––––––––––––––––––––––––––––––––––––––––––––– -->
-    <link rel='stylesheet' type='text/css' href='css/vendor/skeleton.min.css' />
-    <link rel='stylesheet' type='text/css' href='css/vendor/solarized-dark.css' />
-    <link rel='stylesheet' type='text/css' href='css/style.css' />
+    <!-- CSS -->
+    <link rel='stylesheet' type='text/css' href='css/app.css' />
   </head>
   <body>
 
-    <!-- Primary Page Layout
-    –––––––––––––––––––––––––––––––––––––––––––––––––– -->
+    <!-- Page Layout -->
     <div class='container'>
       <div class='console-outer'>
         <div class='console-inner'>
@@ -27,12 +23,12 @@
       </div>
     </div>
 
-    <!-- Scripts
-    –––––––––––––––––––––––––––––––––––––––––––––––––– -->
-    <script src='js/vendor/riot+compiler.min.js'></script>
-    <script src='js/vendor/highlight.pack.js'></script>
-    <script src='js/pgsh.js'></script>
-    <script src='tags/terminal-ui.tag' type='riot/tag'></script>
+    <!-- Scripts -->
+    <!-- appjsplaceholder -->
+    <script type='text/javascript' src='js/vendor/riot+compiler.min.js'></script>
+    <script type='text/javascript' src='js/vendor/highlight.pack.js'></script>
+    <script type='text/javascript' src='js/pgsh.js'></script>
+    <script type='riot/tag' src='tags/terminal-ui.tag'></script>
     <script>riot.mount('*')</script>
   </body>
 </html>