From 33d867509db751a51bfd8fbe59c9909f3e8c5f5a Mon Sep 17 00:00:00 2001 From: Adam Tumminaro Date: Fri, 20 Sep 2019 09:58:06 -0500 Subject: [PATCH] adds configurable resourcePath --- lib/miniprofiler.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/miniprofiler.js b/lib/miniprofiler.js index 3f2a2f4..fabee6d 100755 --- a/lib/miniprofiler.js +++ b/lib/miniprofiler.js @@ -17,10 +17,11 @@ var clientParser = require('./client-parser.js'); const hostname = require('os').hostname; -var ignoredPaths = []; + var ignoredPaths = []; var trivialDurationThresholdMilliseconds = 2.5; var popupShowTimeWithChildren = false; var popupRenderPosition = 'left'; + var resourcePath = '/mini-profiler-resources/'; exports.storage = { InMemoryStorage: require('./storages/inmemory.js'), @@ -47,7 +48,6 @@ for (let framework of ['koa', 'express', 'hapi']) { exports[framework].for = func.buildMiddleware; } -var resourcePath = '/mini-profiler-resources/'; var version = require('../package.json').version; var contentTypes = { @@ -218,6 +218,7 @@ function include(id) { * - trivialDurationThresholdMilliseconds: double ; any step lasting longer than this will be considered trivial, and hidden by default * - popupShowTimeWithChildren: boolean ; whether or not to include the "time with children" column * - popupRenderPosition: 'left', 'right', 'bottomLeft', 'bottomRight' ; which side of the screen to display timings on + * - resourcePath: string ; if your site root is in a subdirectory, specify here, e.g., /siteroot */ function configure(options){ options = options || {}; @@ -227,6 +228,7 @@ function include(id) { popupShowTimeWithChildren = options.popupShowTimeWithChildren || popupShowTimeWithChildren; popupRenderPosition = options.popupRenderPosition || popupRenderPosition; storage = options.storage || storage; + resourcePath = `${options.resourcePath || ''}/${resourcePath}`; } /*