|
|
|
@ -26,6 +26,24 @@ function sendStylesheet(req, res, next) {
|
|
|
|
|
res.type('text/css').send(200, meta.css.cache);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function setupPluginSourceMapping(app) {
|
|
|
|
|
/*
|
|
|
|
|
These mappings are utilised by the source map file, as client-side
|
|
|
|
|
scripts defined in `scripts` in plugin.json are not normally
|
|
|
|
|
served to the end-user. These mappings are only accessible via
|
|
|
|
|
development mode (`./nodebb dev`)
|
|
|
|
|
*/
|
|
|
|
|
var routes = plugins.clientScripts,
|
|
|
|
|
mapping;
|
|
|
|
|
|
|
|
|
|
routes.forEach(function(route) {
|
|
|
|
|
mapping = '/' + route.split('/').slice(7).join('/');
|
|
|
|
|
app.get(mapping, function(req, res) {
|
|
|
|
|
res.type('text/javascript').sendfile(route);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.exports = function(app, middleware, controllers) {
|
|
|
|
|
app.get('/stylesheet.css', sendStylesheet);
|
|
|
|
|
app.get('/nodebb.min.js', sendMinifiedJS);
|
|
|
|
@ -34,5 +52,6 @@ module.exports = function(app, middleware, controllers) {
|
|
|
|
|
|
|
|
|
|
if (!minificationEnabled) {
|
|
|
|
|
app.get('/nodebb.min.js.map', sendSourceMap);
|
|
|
|
|
setupPluginSourceMapping(app);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|