|
|
@@ -1,24 +1,31 @@
|
|
|
-# Title
|
|
|
+# vim: set sw=2 ts=2 sts=2 et tw=80 fmr={{{,}}} fdl=0 fdm=marker:
|
|
|
+# pgs-cli build.
|
|
|
+
|
|
|
+.PHONY: help dist
|
|
|
|
|
|
# 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"
|
|
|
+ # --- Create Folders ---
|
|
|
+ @mkdir -p dist/css dist/js dist/tags
|
|
|
+ # --- Combine CSS ---
|
|
|
+ @for file in $$(cat css/app.css | sed "$(CSS_FILES)"); do \
|
|
|
+ cat css/$$file >> dist/css/app.css; \
|
|
|
+ done
|
|
|
+ # --- Combine Javascript ---
|
|
|
+ @for file in $$(grep "$(JS_TAGS)" index.html | sed "$(JS_FILES)"); do \
|
|
|
+ cat $$file >> dist/js/app.js; \
|
|
|
+ done
|
|
|
+ # --- Copy Riot Tags ---
|
|
|
@cp tags/*.tag dist/tags/
|
|
|
- @echo "adjusting index.html"
|
|
|
+ # --- Modify Index Page ---
|
|
|
@sed "/$(JS_TAGS)/D" index.html | sed "s|$(APPJS_PH)|$(APPJS_TAG)|" > dist/index.html
|
|
|
- @echo "all done!"
|
|
|
+ @echo "All Done!"
|
|
|
|
|
|
-JS_TAGS = <script.*type='text\/javascript'
|
|
|
+CSS_FILES = s|@import.*[\'\"]\(.*\)[\'\"].*|\1|
|
|
|
+JS_TAGS = <script .*src=[\'\"].*\.js[\'\"]
|
|
|
+JS_FILES = s|.*src=[\'\"]\(.*\.js\)[\'\"].*|\1|
|
|
|
APPJS_PH = <!-- appjsplaceholder -->
|
|
|
-APPJS_TAG = <script type='text/javascript' src='js/app.js'><\/script>
|
|
|
+APPJS_TAG = <script type='text/javascript' src='js/app.js'></script>
|