From a15924275330e85e60421d816fd87b204b7e9260 Mon Sep 17 00:00:00 2001 From: Luke Page Date: Fri, 22 Mar 2013 10:29:17 +0000 Subject: [PATCH] rename import silent to import mute. Fixes #1210 --- CHANGELOG.md | 2 +- lib/less/env.js | 2 +- lib/less/index.js | 2 +- lib/less/parser.js | 6 +++--- lib/less/tree/comment.js | 6 +++--- lib/less/tree/directive.js | 10 +++++----- lib/less/tree/media.js | 8 ++++---- lib/less/tree/mixin.js | 6 +++--- lib/less/tree/ruleset.js | 6 +++--- lib/less/tree/selector.js | 14 +++++++------- test/css/{import-silent.css => import-mute.css} | 0 test/less/{import-silent.less => import-mute.less} | 8 ++++---- .../{import-silent.less => import-mute.less} | 0 13 files changed, 35 insertions(+), 35 deletions(-) rename test/css/{import-silent.css => import-mute.css} (100%) rename test/less/{import-silent.less => import-mute.less} (54%) rename test/less/import/{import-silent.less => import-mute.less} (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index a716df4ff..5ac2d1f05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ - support for import inline option to include css that you do not want less to parse e.g. `@import (inline) "file.css";` - better support for modifyVars (refresh styles with new variables, using a file cache), is now more resiliant - - support for import silent option to reference external css, but not output it. Any mixin calls or extend's will be output. + - support for import mute option to reference external css, but not output it. Any mixin calls or extend's will be output. # 1.4.0 Beta 3 diff --git a/lib/less/env.js b/lib/less/env.js index bd53fc943..6153207df 100644 --- a/lib/less/env.js +++ b/lib/less/env.js @@ -23,7 +23,7 @@ // 'currentDirectory' - path to the current file, absolute // 'rootFilename' - filename of the base file // 'entryPath' - absolute path to the entry file - // 'silent' - whether the file should be silent and only output parts that are referenced + // 'mute' - whether the file should be mute and only output parts that are referenced tree.parseEnv = function(options) { copyFromOriginal(options, this, parseCopyProperties); diff --git a/lib/less/index.js b/lib/less/index.js index 1656133ee..b2e7378be 100644 --- a/lib/less/index.js +++ b/lib/less/index.js @@ -83,7 +83,7 @@ var less = { }, writeError: function (ctx, options) { options = options || {}; - if (options.silent) { return } + if (options.silent) { return; } sys.error(less.formatError(ctx, options)); } }; diff --git a/lib/less/parser.js b/lib/less/parser.js index f14c882b2..bec7f3504 100644 --- a/lib/less/parser.js +++ b/lib/less/parser.js @@ -106,8 +106,8 @@ less.Parser = function Parser(env) { newEnv.processImports = false; newEnv.contents[fullPath] = contents; - if (currentFileInfo.silent || importOptions.silent) { - newFileInfo.silent = true; + if (currentFileInfo.mute || importOptions.mute) { + newFileInfo.mute = true; } if (importOptions.inline) { @@ -1320,7 +1320,7 @@ less.Parser = function Parser(env) { }, importOption: function() { - var opt = $(/^(less|css|multiple|once|inline|silent)/); + var opt = $(/^(less|css|multiple|once|inline|mute)/); if (opt) { return opt[1]; } diff --git a/lib/less/tree/comment.js b/lib/less/tree/comment.js index 8d81f8fd9..eb93448a5 100644 --- a/lib/less/tree/comment.js +++ b/lib/less/tree/comment.js @@ -8,11 +8,11 @@ tree.Comment = function (value, silent, index, currentFileInfo) { tree.Comment.prototype = { type: "Comment", toCSS: function (env) { - return (env.compress || (this.currentFileInfo && this.currentFileInfo.silent && !this.isNotSilent)) ? '' : this.value; + return (env.compress || (this.currentFileInfo && this.currentFileInfo.mute && !this.isNotMute)) ? '' : this.value; }, eval: function () { return this; }, - markNotSilent: function () { - this.isNotSilent = true; + markNotMute: function () { + this.isNotMute = true; } }; diff --git a/lib/less/tree/directive.js b/lib/less/tree/directive.js index 6105f0e4c..446426652 100644 --- a/lib/less/tree/directive.js +++ b/lib/less/tree/directive.js @@ -19,7 +19,7 @@ tree.Directive.prototype = { }, toCSS: function (env) { - if (this.currentFileInfo.silent && !this.isNotSilent) { + if (this.currentFileInfo.mute && !this.isNotMute) { return ""; } @@ -45,14 +45,14 @@ tree.Directive.prototype = { variable: function (name) { return tree.Ruleset.prototype.variable.call(this.ruleset, name) }, find: function () { return tree.Ruleset.prototype.find.apply(this.ruleset, arguments) }, rulesets: function () { return tree.Ruleset.prototype.rulesets.apply(this.ruleset) }, - markNotSilent: function () { + markNotMute: function () { var rule, i; - this.isNotSilent = true; + this.isNotMute = true; if (this.ruleset) { for (i = 0; i < this.ruleset.rules.length; i++) { rule = this.ruleset.rules[i]; - if (rule.markNotSilent) { - rule.markNotSilent(); + if (rule.markNotMute) { + rule.markNotMute(); } } } diff --git a/lib/less/tree/media.js b/lib/less/tree/media.js index 709261f00..1d3db9dec 100644 --- a/lib/less/tree/media.js +++ b/lib/less/tree/media.js @@ -72,13 +72,13 @@ tree.Media.prototype = { var el = new(tree.Element)('', '&', 0); return [new(tree.Selector)([el], null, this.index, this.currentFileInfo)]; }, - markNotSilent: function () { + markNotMute: function () { var rule, i; - this.isNotSilent = true; + this.isNotMute = true; for (i = 0; i < this.ruleset.rules.length; i++) { rule = this.ruleset.rules[i]; - if (rule.markNotSilent) { - rule.markNotSilent(); + if (rule.markNotMute) { + rule.markNotMute(); } } }, diff --git a/lib/less/tree/mixin.js b/lib/less/tree/mixin.js index 3d05f62a1..1b6eb4026 100644 --- a/lib/less/tree/mixin.js +++ b/lib/less/tree/mixin.js @@ -49,11 +49,11 @@ tree.mixin.Call.prototype = { } } if (match) { - if (!this.currentFileInfo || !this.currentFileInfo.silent) { + if (!this.currentFileInfo || !this.currentFileInfo.mute) { for (i = 0; i < rules.length; i++) { rule = rules[i]; - if (rule.markNotSilent) { - rule.markNotSilent(); + if (rule.markNotMute) { + rule.markNotMute(); } } } diff --git a/lib/less/tree/ruleset.js b/lib/less/tree/ruleset.js index 3401556a8..4de3604fd 100644 --- a/lib/less/tree/ruleset.js +++ b/lib/less/tree/ruleset.js @@ -245,7 +245,7 @@ tree.Ruleset.prototype = { .filter(function(p) { var i; for(i = 0; i < p.length; i++) { - if (!p[i].isSilent()) { + if (!p[i].isMute()) { return true; } return false; @@ -278,9 +278,9 @@ tree.Ruleset.prototype = { return css.join('') + (env.compress ? '\n' : ''); }, - markNotSilent: function () { + markNotMute: function () { for (var s = 0; s < this.selectors.length; s++) { - this.selectors[s].markNotSilent(); + this.selectors[s].markNotMute(); } }, diff --git a/lib/less/tree/selector.js b/lib/less/tree/selector.js index 72c8c26e3..180ebd779 100644 --- a/lib/less/tree/selector.js +++ b/lib/less/tree/selector.js @@ -1,10 +1,10 @@ (function (tree) { -tree.Selector = function (elements, extendList, index, currentFileInfo, isNotSilent) { +tree.Selector = function (elements, extendList, index, currentFileInfo, isNotMute) { this.elements = elements; this.extendList = extendList || []; this.currentFileInfo = currentFileInfo || {}; - this.isNotSilent = isNotSilent; + this.isNotMute = isNotMute; }; tree.Selector.prototype = { type: "Selector", @@ -13,7 +13,7 @@ tree.Selector.prototype = { this.extendList = visitor.visit(this.extendList) }, createDerived: function(elements, extendList) { - return new(tree.Selector)(elements, extendList || this.extendList, this.index, this.currentFileInfo, this.isNotSilent); + return new(tree.Selector)(elements, extendList || this.extendList, this.index, this.currentFileInfo, this.isNotMute); }, match: function (other) { var elements = this.elements, @@ -62,11 +62,11 @@ tree.Selector.prototype = { return this._css; }, - markNotSilent: function () { - this.isNotSilent = true; + markNotMute: function () { + this.isNotMute = true; }, - isSilent: function() { - return this.currentFileInfo.silent && !this.isNotSilent; + isMute: function() { + return this.currentFileInfo.mute && !this.isNotMute; } }; diff --git a/test/css/import-silent.css b/test/css/import-mute.css similarity index 100% rename from test/css/import-silent.css rename to test/css/import-mute.css diff --git a/test/less/import-silent.less b/test/less/import-mute.less similarity index 54% rename from test/less/import-silent.less rename to test/less/import-mute.less index f401e07a1..df5d561c8 100644 --- a/test/less/import-silent.less +++ b/test/less/import-mute.less @@ -1,11 +1,11 @@ -@import (silent) url("import-once.less"); -@import (silent) url("css-3.less"); -@import (silent) url("media.less"); +@import (mute) url("import-once.less"); +@import (mute) url("css-3.less"); +@import (mute) url("media.less"); /* The media statement above is invalid (no selector) We should ban invalid media queries with properties and no selector? */ -@import (silent) url("import/import-silent.less"); +@import (mute) url("import/import-mute.less"); .b { .z(); diff --git a/test/less/import/import-silent.less b/test/less/import/import-mute.less similarity index 100% rename from test/less/import/import-silent.less rename to test/less/import/import-mute.less