Support reading less options from its script tag data attributes#2243
Support reading less options from its script tag data attributes#2243lukeapage merged 4 commits intoless:masterfrom
Conversation
|
Nice idea. Will have a think but am initially keen on it. |
|
agreed, would be nice! |
|
@seven-phases-max What do you think? |
|
Assuming it's relatively lightweight, why not? |
|
@lejenome We'll take your other commit too, please, so this also applies to less tags |
|
done |
Support reading less options from its script tag data attributes
|
thanks then! |
|
I would but my English really sucks
|
|
No problem, myself or someone else will get round to it. |
|
docs added: less/less-docs@ebf87fc |
|
This conflicts with RequireJS's <script data-main="js/main.js" src="bower/requirejs/require.js" type="text/javascript"></script>Instead of going through all options at least check for only known ones: var stringOptions = ['env', 'dumpLineNumbers', 'rootpath', 'errorReporting',
jsonOptions = ['...'];
// ...
if (stringOptions.indexOf(opt) != -1) {
options[opt] = tag.dataset[opt];
} else if (jsonOptions.indexOf(opt) != -1) {
options[opt] = JSON.parse(tag.dataset[opt]);
} else {
// do nothing
} |
add support to reading less script tag data attr like this:
it is more easier and cleaner.
if you found this useful, I will send an extra commit that will add support to read data attributes from less files link tag too (useful it needs some specific options per less file like following)