From 2177bf43cab6354a408799ed7d638507e1ed4af4 Mon Sep 17 00:00:00 2001 From: witzig Date: Fri, 10 Mar 2017 11:27:56 +0100 Subject: [PATCH] Inject custom CSS and JS files in layout.hbs --- app.js | 3 +++ config/default.toml | 6 ++++++ views/layout.hbs | 8 ++++++++ 3 files changed, 17 insertions(+) diff --git a/app.js b/app.js index 51a4a915..97289f44 100644 --- a/app.js +++ b/app.js @@ -180,6 +180,9 @@ app.use((req, res, next) => { res.locals.menu = menu; tools.updateMenu(res); + res.locals.customStyles = config.customstyles || []; + res.locals.customScripts = config.customscripts || []; + settingsModel.list(['ua_code', 'shoutout'], (err, configItems) => { if (err) { return next(err); diff --git a/config/default.toml b/config/default.toml index c547295e..ddb2f5f9 100644 --- a/config/default.toml +++ b/config/default.toml @@ -30,6 +30,12 @@ editors=[ # Default language to use language="en" +# Inject custom styles in layout.hbs +# customstyles=["/custom/hello-world.css"] + +# Inject custom scripts in layout.hbs +# customscripts=["/custom/hello-world.js"] + # If you start out as a root user (eg. if you want to use ports lower than 1000) # then you can downgrade the user once all services are up and running #user="nobody" diff --git a/views/layout.hbs b/views/layout.hbs index 9e9e3a95..e5077360 100644 --- a/views/layout.hbs +++ b/views/layout.hbs @@ -25,6 +25,14 @@ {{/if}} + {{#each customStyles}} + + {{/each}} + + {{#each customScripts}} + + {{/each}} +