[Pkg-javascript-commits] [less.js] 23/38: add an onReady option that disables less running on page load. Fixes #2327

Jonas Smedegaard dr at jones.dk
Mon Oct 26 23:27:27 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag v2.2.0
in repository less.js.

commit e9b227c9ac03252aca0ab0cda1e3184a76862855
Author: Luke Page <luke.a.page at gmail.com>
Date:   Sat Jan 3 09:12:04 2015 +0000

    add an onReady option that disables less running on page load. Fixes #2327
---
 lib/less-browser/add-default-options.js |  4 ++++
 lib/less-browser/bootstrap.js           | 20 +++++++++++---------
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/lib/less-browser/add-default-options.js b/lib/less-browser/add-default-options.js
index c13bada..9742fe4 100644
--- a/lib/less-browser/add-default-options.js
+++ b/lib/less-browser/add-default-options.js
@@ -39,4 +39,8 @@ module.exports = function(window, options) {
         options.useFileCache = true;
     }
 
+	if (options.onReady === undefined) {
+		options.onReady = true;
+	}
+
 };
diff --git a/lib/less-browser/bootstrap.js b/lib/less-browser/bootstrap.js
index 766665f..642214c 100644
--- a/lib/less-browser/bootstrap.js
+++ b/lib/less-browser/bootstrap.js
@@ -13,12 +13,14 @@ require("./add-default-options")(window, options);
 
 var less = module.exports = require("./index")(window, options);
 
-if (/!watch/.test(window.location.hash)) {
-    less.watch();
-}
-
-less.pageLoadFinished = less.registerStylesheets().then(
-    function () {
-        return less.refresh(less.env === 'development');
-    }
-);
+if (options.onReady) {
+	if (/!watch/.test(window.location.hash)) {
+		less.watch();
+	}
+	
+	less.pageLoadFinished = less.registerStylesheets().then(
+		function () {
+			return less.refresh(less.env === 'development');
+		}
+	);
+}
\ No newline at end of file

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/less.js.git



More information about the Pkg-javascript-commits mailing list