From 751e79839553612d03acf814e56e8090c1cc4848 Mon Sep 17 00:00:00 2001 From: Immanuel Onyeka Date: Sun, 30 Oct 2022 17:12:53 -0400 Subject: [PATCH] Setup Vue --- .gitignore | 1 + README.md | 6 ++++++ app.tpl | 6 ++++++ assets/image/icon/sheriff-hat-50.png | Bin 0 -> 6860 bytes assets/main.css | 3 +++ components/App.vue | 6 ++++++ home.tpl | 9 +++++++++ main.js | 5 +++++ master.tpl | 10 ++-------- skouter.go | 10 +++++++++- webpack.config.js | 27 +++++++++++++++++++++++++++ 11 files changed, 74 insertions(+), 9 deletions(-) create mode 100644 README.md create mode 100644 app.tpl create mode 100644 assets/image/icon/sheriff-hat-50.png create mode 100644 assets/main.css create mode 100644 components/App.vue create mode 100644 main.js create mode 100644 webpack.config.js diff --git a/.gitignore b/.gitignore index 0745553..5857228 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ node_modules/ skouter *.sw[poqa] .env +assets/app.js diff --git a/README.md b/README.md new file mode 100644 index 0000000..cf5c7f8 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ + + +### Bundling ### +Uses ESbuild and the Vue node package. +`sudo apt install esbuild; npm install vue;` +`` diff --git a/app.tpl b/app.tpl new file mode 100644 index 0000000..9afcd77 --- /dev/null +++ b/app.tpl @@ -0,0 +1,6 @@ +{{define "main"}} +
+
+
+ +{{end}} diff --git a/assets/image/icon/sheriff-hat-50.png b/assets/image/icon/sheriff-hat-50.png new file mode 100644 index 0000000000000000000000000000000000000000..91794139386c650cca3bc275dfefb8e183375377 GIT binary patch literal 6860 zcmV;-8Z+gIP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+U1&8k|Vjfh2OCXEdkyv2R7pFK+D&6kYsgLo0)E1 zy(rWinqel9z;BL0mf8ROzhnNvzZ7jXF_oHI&X#|%#pXL7s(t>o`|51GulHZ@uVe1( z_vYh(=c}MIpZ_iWb$;jj^z8@lYq;_CdsAOWe0>e%J_defpeyV1{yfP$v-`b^uYua@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+5ZvRfI}}^9Qj)SczTqEDZwc@Ep9q_a=`i*#+oQucA>-Q77Gxokf89iIbYzCA>yk{F3U^1{p^y)6Tfsk-VAw;$% zv~5sE&lNI1NC>Wh)ww25i4K`V12esKtwLh1D0@Z1-mOf!~1-fDgTOZNZp=qSu)37z;cm1TN39x95O&k_vnIh(y3*3AdvhgiZrHrLeFS z_*Qa@wDqt_68_&IK59UowHkqyxvG=V85WDg;;e}Im86Awul}Hj&QUQMo$`H%JXIok zb%E&Q+sChRpj+~lSfiAuHyC(9PGv|+$;p;jOY4#t>@^9CvS+10C$}?Hy!w-|QqS4M z_hL}i0Uc=z-36zXfkIy`vONQsBK4?Z@TcfmMhbfSfo!3b`ciAZQ83SC5)q7-8rG1Q z`Rx?*+bJfvRh~b3#jupW8T#V?k*HA9TSggWlu^b7i+=$@N1Wa#1op=O0000 +
hello world
+ + + diff --git a/home.tpl b/home.tpl index 5628346..d4b17c4 100644 --- a/home.tpl +++ b/home.tpl @@ -1,3 +1,12 @@ +{{define "header"}} +
+ +
+{{end}} + {{define "main"}}
diff --git a/main.js b/main.js new file mode 100644 index 0000000..68b4a26 --- /dev/null +++ b/main.js @@ -0,0 +1,5 @@ +import {createApp} from "vue" +import App from "./components/App.vue" +import "./assets/main.css" + +createApp(App).mount("#app") diff --git a/master.tpl b/master.tpl index 9ac8f04..f977142 100644 --- a/master.tpl +++ b/master.tpl @@ -3,20 +3,14 @@ - + + href="/assets/image/icon/sheriff-hat-50.png" /> Skouter - {{.Title}} {{block "header" .}} -
- -
{{end}} {{template "main" .}} diff --git a/skouter.go b/skouter.go index cb3e4e4..fbfe7df 100644 --- a/skouter.go +++ b/skouter.go @@ -23,11 +23,13 @@ var ( var paths = map[string]string { "home": "home.tpl", "terms": "terms.tpl", + "app": "app.tpl", } var pages = map[string]Page { "home": cache("home", "Home"), "terms": cache("terms", "Terms and Conditions"), + "app": cache("app", "App"), } func cache(name string, title string) Page { @@ -72,6 +74,10 @@ func route(w http.ResponseWriter, r *http.Request) { page = pages[ "home" ] case match(p, "/terms", &args): page = pages[ "terms" ] + case match(p, "/app", &args): + page = pages[ "app" ] + case match(p, "/assets", &args): + page = pages[ "app" ] default: http.NotFound(w, r) return @@ -81,7 +87,9 @@ func route(w http.ResponseWriter, r *http.Request) { } func main() { + files := http.FileServer(http.Dir("")) + + http.Handle("/assets/", files) http.HandleFunc("/", route) log.Fatal(http.ListenAndServe(address, nil)) } - diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..f25ebd0 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,27 @@ +const { VueLoaderPlugin } = require('vue-loader') +const path = require('path'); + +module.exports = { + entry: './main.js', + output: { + path: path.resolve(__dirname, 'assets'), + filename: 'app.js' + }, + module: { + rules: [ + {test: /\.vue$/, use: 'vue-loader'}, + {test: /\.css$/, use: 'css-loader'} + ] + }, + devServer: { + static: './assets', + proxy: { + '*': {target: 'http://localhost:8001', + secure: false, + changeOrigin: true + } + } + }, + // Required for also applying rules to sections of SFC + plugins: [new VueLoaderPlugin()], +};