From 792f7bcc64aba4334dc9d66bf6b86e205ff2ec27 Mon Sep 17 00:00:00 2001 From: Caleb James DeLisle Date: Sat, 14 Jul 2018 15:21:45 +0200 Subject: [PATCH] show how long less takes to compile --- www/common/LessLoader.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/www/common/LessLoader.js b/www/common/LessLoader.js index 04fa68714..8846000f0 100644 --- a/www/common/LessLoader.js +++ b/www/common/LessLoader.js @@ -134,10 +134,15 @@ define([ }; module.exports.load = function (url /*:string*/, cb /*:()=>void*/) { + var btime = +new Date(); + var done = function () { + console.log("Compiling [" + url + "] took " + (+new Date() - btime) + "ms"); + cb(); + }; cacheGet(url, function (css) { if (css) { inject(css, url); - return void cb(); + return void done(); } console.log('CACHE MISS ' + url); ((/\.less([\?\#].*)?$/.test(url)) ? loadLess : loadCSS)(url, function (err, css) { @@ -145,7 +150,7 @@ define([ var output = fixAllURLs(css, url); cachePut(url, output); inject(output, url); - cb(); + done(); }); }); };