|
1 | 1 | /*!
|
2 |
| - * Less - Leaner CSS v2.5.0 |
| 2 | + * Less - Leaner CSS v2.5.1 |
3 | 3 | * http://lesscss.org
|
4 | 4 | *
|
5 | 5 | * Copyright (c) 2009-2015, Alexis Sellier <[email protected]>
|
@@ -74,17 +74,17 @@ require("./add-default-options")(window, options);
|
74 | 74 |
|
75 | 75 | var less = module.exports = require("./index")(window, options);
|
76 | 76 |
|
| 77 | +window.less = less; |
| 78 | + |
77 | 79 | if (options.onReady) {
|
78 | 80 | if (/!watch/.test(window.location.hash)) {
|
79 | 81 | less.watch();
|
80 | 82 | }
|
81 | 83 |
|
82 |
| - less.pageLoadFinished = less.registerStylesheets().then( |
83 |
| - function () { |
84 |
| - return less.refresh(less.env === 'development'); |
85 |
| - } |
86 |
| - ); |
| 84 | + less.registerStylesheetsImmediately(); |
| 85 | + less.pageLoadFinished = less.refresh(less.env === 'development'); |
87 | 86 | }
|
| 87 | + |
88 | 88 | },{"./add-default-options":1,"./index":7,"promise/polyfill.js":94}],3:[function(require,module,exports){
|
89 | 89 | var utils = require("./utils");
|
90 | 90 | module.exports = {
|
@@ -671,20 +671,28 @@ module.exports = function(window, options) {
|
671 | 671 | less.unwatch = function () {clearInterval(less.watchTimer); this.watchMode = false; return false; };
|
672 | 672 |
|
673 | 673 | //
|
674 |
| - // Get all <link> tags with the 'rel' attribute set to "stylesheet/less" |
| 674 | + // Synchronously get all <link> tags with the 'rel' attribute set to |
| 675 | + // "stylesheet/less". |
675 | 676 | //
|
676 |
| - less.registerStylesheets = function() { |
677 |
| - return new Promise(function(resolve, reject) { |
678 |
| - var links = document.getElementsByTagName('link'); |
679 |
| - less.sheets = []; |
| 677 | + less.registerStylesheetsImmediately = function() { |
| 678 | + var links = document.getElementsByTagName('link'); |
| 679 | + less.sheets = []; |
680 | 680 |
|
681 |
| - for (var i = 0; i < links.length; i++) { |
682 |
| - if (links[i].rel === 'stylesheet/less' || (links[i].rel.match(/stylesheet/) && |
683 |
| - (links[i].type.match(typePattern)))) { |
684 |
| - less.sheets.push(links[i]); |
685 |
| - } |
| 681 | + for (var i = 0; i < links.length; i++) { |
| 682 | + if (links[i].rel === 'stylesheet/less' || (links[i].rel.match(/stylesheet/) && |
| 683 | + (links[i].type.match(typePattern)))) { |
| 684 | + less.sheets.push(links[i]); |
686 | 685 | }
|
| 686 | + } |
| 687 | + }; |
687 | 688 |
|
| 689 | + // |
| 690 | + // Asynchronously get all <link> tags with the 'rel' attribute set to |
| 691 | + // "stylesheet/less", returning a Promise. |
| 692 | + // |
| 693 | + less.registerStylesheets = function() { |
| 694 | + return new Promise(function(resolve, reject) { |
| 695 | + less.registerStylesheetsImmediately(); |
688 | 696 | resolve();
|
689 | 697 | });
|
690 | 698 | };
|
@@ -2372,7 +2380,7 @@ module.exports = function(environment, fileManagers) {
|
2372 | 2380 | var SourceMapOutput, SourceMapBuilder, ParseTree, ImportManager, Environment;
|
2373 | 2381 |
|
2374 | 2382 | var less = {
|
2375 |
| - version: [2, 5, 0], |
| 2383 | + version: [2, 5, 1], |
2376 | 2384 | data: require('./data'),
|
2377 | 2385 | tree: require('./tree'),
|
2378 | 2386 | Environment: (Environment = require("./environment/environment")),
|
@@ -7002,7 +7010,7 @@ Definition.prototype.matchCondition = function (args, context) {
|
7002 | 7010 | new contexts.Eval(context,
|
7003 | 7011 | [this.evalParams(context, /* the parameter variables*/
|
7004 | 7012 | new contexts.Eval(context, this.frames ? this.frames.concat(context.frames) : context.frames), args, [])]
|
7005 |
| - .concat(this.frames) // the parent namespace/mixin frames |
| 7013 | + .concat(this.frames || []) // the parent namespace/mixin frames |
7006 | 7014 | .concat(context.frames)))) { // the current environment frames
|
7007 | 7015 | return false;
|
7008 | 7016 | }
|
@@ -7630,7 +7638,7 @@ Ruleset.prototype.variable = function (name) {
|
7630 | 7638 | return this.variables()[name];
|
7631 | 7639 | };
|
7632 | 7640 | Ruleset.prototype.rulesets = function () {
|
7633 |
| - if (!this.rules) { return null; } |
| 7641 | + if (!this.rules) { return []; } |
7634 | 7642 |
|
7635 | 7643 | var filtRules = [], rules = this.rules, cnt = rules.length,
|
7636 | 7644 | i, rule;
|
|
0 commit comments