Enabling static files somewhere else

master
Thomas Forgione 5 years ago
parent 5ad9d41eca
commit a6753d9f44
No known key found for this signature in database
GPG Key ID: 3B8FC64F5BBFE109

@ -43,4 +43,4 @@ block extracss
}
block extrajs
script(src="/static/js/totalTable.js")
script(src=getStatic('js/totalTable.js'))

@ -13,6 +13,8 @@ module.exports.PORT = 4000;
module.exports.ADE_BASE_URL =
"https://edt.inp-toulouse.fr/jsp/custom/modules/plannings/anonymous_cal.jsp?"
module.exports.STATIC_URL = '/static/';
const privateConf = require('./private.js');
for (let key in privateConf) {

@ -4,7 +4,7 @@ html
meta(charset='utf-8')
meta(name='viewport', content='width=device-width, initial-scale=1, shrink-to-fit=no')
block css
link(rel='stylesheet', href='/static/bootstrap/css/bootstrap.min.css')
link(rel='stylesheet', href=getStatic('bootstrap/css/bootstrap.min.css'))
style.
.navbar .btn {
margin-right: 10px;
@ -47,8 +47,8 @@ html
.container
block content
script(src='/static/bootstrap/js/jquery.min.js')
script(src='/static/bootstrap/js/popper.min.js')
script(src='/static/bootstrap/js/bootstrap.min.js')
script(src=getStatic('bootstrap/js/jquery.min.js'))
script(src=getStatic('bootstrap/js/popper.min.js'))
script(src=getStatic('bootstrap/js/bootstrap.min.js'))
block extrajs

@ -1,3 +1,5 @@
const config = require('settings/config');
let urls = {};
class Url {
@ -13,12 +15,18 @@ function getUrl(name) {
return urls[name].url;
}
function getStatic(name) {
return config.STATIC_URL + name
}
module.exports = function(req, res, next) {
res.locals.getUrl = getUrl;
res.locals.getStatic = getStatic;
return next();
}
module.exports.getUrl = getUrl;
module.exports.getStatic = getStatic;
module.exports.url = function(url, viewName, urlName, method) {
let ret = new Url(url, viewName, urlName, method);

Loading…
Cancel
Save