Attempt to select vue file in layout from app.locals variable
authorBenjamin Auder <benjamin.auder@somewhere>
Sat, 22 Dec 2018 21:41:09 +0000 (22:41 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Sat, 22 Dec 2018 21:41:09 +0000 (22:41 +0100)
app.js
views/layout.pug

diff --git a/app.js b/app.js
index e32ef39..b44be79 100644 (file)
--- 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');
index f49657e..5df5212 100644 (file)
@@ -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