-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
124 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,39 @@ | ||
| var getRTLPlugin = require("./rtl-plugin"), | ||
| RTLVariablePlugin = require("./rtl-variable-plugin"); | ||
|
|
||
| module.exports = { | ||
| function LessPluginRTL(options) { | ||
| this.setOptions(options); | ||
| } | ||
|
|
||
| LessPluginRTL.prototype = { | ||
| install: function(less, pluginManager) { | ||
| var RTLPlugin = getRTLPlugin(less); | ||
| pluginManager.addVisitor(new RTLPlugin()); | ||
| pluginManager.addPreProcessor(new RTLVariablePlugin()); | ||
| } | ||
| if (this.options.dir === "RTL") { | ||
| var RTLPlugin = getRTLPlugin(less); | ||
| pluginManager.addVisitor(new RTLPlugin()); | ||
| } | ||
| pluginManager.addPreProcessor(new RTLVariablePlugin(this.options.dir === "RTL")); | ||
| }, | ||
| printUsage: function () { | ||
| console.log("RTL Plugin"); | ||
| console.log("use dir=RTL or dir=LTR") | ||
| }, | ||
| setOptions: function(options) { | ||
| this.options = this.parseOptions(options); | ||
| }, | ||
| parseOptions: function(options) { | ||
| if (!options) { | ||
| options = {dir: "RTL"}; | ||
| } | ||
| if (typeof options === "string") { | ||
| var args = options.match(/dir=(RTL|LTR)/); | ||
| if (!args) { | ||
| throw new Error("Invalid options for "); | ||
| } | ||
| options = {dir: args[1]}; | ||
| } | ||
| return options; | ||
| }, | ||
| minVersion: [2, 4, 0] | ||
| }; | ||
|
|
||
| module.exports = LessPluginRTL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| .reverse { | ||
| float: left; | ||
| float: right /*comment*/; | ||
| margin-left: 5px; | ||
| padding-right: 3px; | ||
| font-size: 12px; | ||
| /* unchanged*/ | ||
| left: 3px; | ||
| border-left-style: dashed; | ||
| } | ||
| .shorthands { | ||
| margin: 5px; | ||
| margin: 6px 7px; | ||
| margin: 1px 7px 3px; | ||
| margin: 1px 2px 3px 4px; | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| .reverse { | ||
| float: left; | ||
| float: right/*comment*/; | ||
| margin-left: 5px; | ||
| padding-right: 3px; | ||
| font-size: 12px; /* unchanged*/ | ||
| left: 3px; | ||
| border-left-style: dashed; | ||
| } | ||
| .shorthands { | ||
| @top: 1px; | ||
| @right: 2px; | ||
| @bottom: 3px; | ||
| @left: 4px; | ||
| @all: 5px; | ||
| @vertical: 6px; | ||
| @horizontal: 7px; | ||
|
|
||
| margin: @all; | ||
| margin: @vertical @horizontal; | ||
| margin: @top @horizontal @bottom; | ||
| margin: @top @right @bottom @left; | ||
| } | ||
| & when (@rtl) { | ||
| .rtl-only { | ||
| margin: 3px; | ||
| } | ||
| } |