From: Benjamin Auder <benjamin.auder@somewhere>
Date: Sat, 22 Dec 2018 21:41:09 +0000 (+0100)
Subject: Attempt to select vue file in layout from app.locals variable
X-Git-Url: https://git.auder.net/%7B%7B%20asset%28%27mixstore/images/assets/doc/html/left.jpg?a=commitdiff_plain;h=fb1ecbdf0326d659c7afab9c55f8c1031f85b1b9;p=vchess.git

Attempt to select vue file in layout from app.locals variable
---

diff --git a/app.js b/app.js
index e32ef39e..b44be791 100644
--- a/app.js
+++ b/app.js
@@ -27,6 +27,9 @@ else
 	}));
 }
 
+// Allow layout.pug to select the right vue file:
+app.locals.development = app.get('env') === 'development';
+
 // view engine setup
 app.set('views', path.join(__dirname, 'views'));
 app.set('view engine', 'pug');
diff --git a/views/layout.pug b/views/layout.pug
index f49657ef..5df5212a 100644
--- a/views/layout.pug
+++ b/views/layout.pug
@@ -28,6 +28,8 @@ html
 			block content
 
 		script(src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.9.1/underscore-min.js")
-		script(src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js")
-		//script(src="https://cdn.jsdelivr.net/npm/vue") //prod
+		if development
+			script(src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js")
+		else
+			script(src="https://cdn.jsdelivr.net/npm/vue")
 		block javascripts