1010 * Guilherme Oenning, 2016 @goenning
1111 */
1212var _ = require ( 'underscore' ) ;
13- var fs = require ( 'fs' ) ;
1413var os = require ( 'os' ) ;
15- var path = require ( 'path' ) ;
1614var qs = require ( 'querystring' ) ;
1715var url = require ( 'url' ) ;
1816var uuid = require ( 'node-uuid' ) ;
1917var debug = require ( 'debug' ) ( 'miniprofiler' ) ;
20-
21- _ . templateSettings = {
22- interpolate : / \{ ( .+ ?) \} / g
23- } ;
18+ var ui = require ( './ui.js' ) ;
2419
2520var ignoredPaths = [ ] ;
2621var trivialDurationThresholdMilliseconds = 2.5 ;
@@ -66,7 +61,6 @@ var storage = function(id, json) {
6661 return null ;
6762} ;
6863
69- var includesDir = path . join ( path . dirname ( module . filename ) , '../ui' ) ;
7064var resourcePath = '/mini-profiler-resources/' ;
7165var version = '' ;
7266
@@ -116,7 +110,7 @@ function handleRequest(f, req, res) {
116110}
117111
118112function assets ( req , res , lastPathSegment , done ) {
119- fs . readFile ( path . join ( includesDir , lastPathSegment ) , 'utf-8' , function ( err , data ) {
113+ ui . readFile ( lastPathSegment , function ( err , data ) {
120114 if ( err ) {
121115 debug ( err ) ;
122116 done ( {
@@ -163,7 +157,7 @@ function results(req, res, lastPathSegment, done) {
163157 done ( {
164158 type : 'text/html; charset=utf-8' ,
165159 status : 200 ,
166- body : includes . share ( {
160+ body : ui . share ( {
167161 name : json . Name ,
168162 duration : json . DurationMilliseconds ,
169163 path : resourcePath ,
@@ -185,13 +179,8 @@ function results(req, res, lastPathSegment, done) {
185179 } ) ;
186180}
187181
188- var includes = {
189- partial : _ . template ( fs . readFileSync ( path . join ( includesDir , 'include.partial.html' ) ) . toString ( ) ) ,
190- share : _ . template ( fs . readFileSync ( path . join ( includesDir , 'share.html' ) ) . toString ( ) )
191- } ;
192-
193182function include ( id ) {
194- return includes . partial ( {
183+ return ui . partial ( {
195184 path : resourcePath ,
196185 position : popupRenderPosition ,
197186 showChildren : popupShowTimeWithChildren ,
0 commit comments