From 6c49318ac7eccfd9829a65f4f8279bad77f880c1 Mon Sep 17 00:00:00 2001 From: Caleb James DeLisle Date: Sat, 14 Jul 2018 15:19:39 +0200 Subject: [PATCH] Show how long it takes to parse less --- www/common/LessLoader.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/www/common/LessLoader.js b/www/common/LessLoader.js index 39f04db5c..a6942ac77 100644 --- a/www/common/LessLoader.js +++ b/www/common/LessLoader.js @@ -152,10 +152,17 @@ define([ }; module.exports.load = function (url /*:string*/, cb /*:()=>void*/, stack /*:?Array*/) { + var btime = stack ? null : +new Date(); stack = stack || []; if (stack.indexOf(url) > -1) { return void cb(); } var timeout = setTimeout(function () { console.log('failed', url); }, 10000); - var done = function () { clearTimeout(timeout); cb(); }; + var done = function () { + clearTimeout(timeout); + if (btime) { + console.log("Compiling [" + url + "] took " + (+new Date() - btime) + "ms"); + } + cb(); + }; stack.push(url); cacheGet(url, function (css) { if (css) { return void loadSubmodulesAndInject(css, url, done, stack); }