From fb1ecbdf0326d659c7afab9c55f8c1031f85b1b9 Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Sat, 22 Dec 2018 22:41:09 +0100
Subject: [PATCH] Attempt to select vue file in layout from app.locals variable

---
 app.js           | 3 +++
 views/layout.pug | 6 ++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

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
-- 
2.44.0