[Pkg-javascript-commits] [less.js] 218/285: add support to read options from script tag data attr
Jonas Smedegaard
dr at jones.dk
Mon Oct 26 23:23:56 UTC 2015
This is an automated email from the git hooks/post-receive script.
js pushed a commit to annotated tag v2.0.0
in repository less.js.
commit e5b18c08cefbf432bab8c8cc6382b09cdd1547cc
Author: Moez Bouhlel <bmoez.j at gmail.com>
Date: Wed Oct 22 16:08:38 2014 +0100
add support to read options from script tag data attr
---
lib/less-browser/index.js | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/lib/less-browser/index.js b/lib/less-browser/index.js
index 0553155..a69ee5c 100644
--- a/lib/less-browser/index.js
+++ b/lib/less-browser/index.js
@@ -14,6 +14,15 @@ var less;
var isFileProtocol = /^(file|chrome(-extension)?|resource|qrc|app):/.test(window.location.protocol),
options = window.less || {};
+// use options from the current script tag data attribues
+var script = document.currentScript || (function() {
+ var scripts = document.getElementsByTagName("script");
+ return scripts[scripts.length - 1];
+})();
+for (var opt in script.dataset)
+ if(script.dataset.hasOwnProperty(opt))
+ options[opt] = script.dataset[opt];
+
// shim Promise if required
require('promise/polyfill.js');
--
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