Example 1 or [Example 2](http://less2css.org/#%7B%22less%22%3A%22%5Cn.nav%20%7B%5Cn%20%20%20%20%26_button%2C%20%20%7B%5Cn%20%20%20%20%20%20%20%20.button-style%3B%5Cn%20%20%20%20%5Cn%20%20%20%20%20%20%20%20%26-mod%20%7B%5Cn%20%20%20%20%20%20%20%20%20%20%20%20.button-style%3B%5Cn%20%20%20%20%20%20%20%20%20%20%20%20color%3A%20red%3B%5Cn%20%20%20%20%20%20%20%20%7D%5Cn%20%20%20%20%7D%5Cn%20%20%20%20%5Cn%20%20%20%20%2F%2F%20reusable%20stuff%3A%5Cn%20%20%20%20.button-style()%20%7B
A simple Map / Associative-Array structure in legacy Less w/o any plugins or so:
-
Example 1 - via mixins (useful when you need complex map "values", e.g. multiple values/properties, rulesets, other mixins... basically anything)
-
[Example 2](http://less2css.org/#%7B%22le
This file contains hidden or 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
| .some {-:-} |
This file contains hidden or 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
| .hide-element-at(@max-width) { | |
| @media (max-width: @max-width) { | |
| display: none; | |
| } | |
| } | |
| .jp-sleek.jp-audio:not(.jp-state-no-volume-support) { | |
| .jp-full-screen {.hide-element-at(400px)} | |
| .jp-repeat {.hide-element-at(450px)} | |
| .jp-download {.hide-element-at(630px)} |
This file contains hidden or 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
| .type(hero, @mb: 1.25rem) { | |
| margin-bottom: @mb; | |
| font-size: 2.625rem; | |
| line-height: 1.238095238; | |
| } | |
| .type(not-a-hero, @mb: 1.55rem) { | |
| margin-bottom: @mb; | |
| font-size: 3.333rem; | |
| line-height: 4.444444444; |
This file contains hidden or 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
| .text-align(@direction) { | |
| text-align: @direction; | |
| // and whatever else you need to associate with this | |
| } | |
| body { | |
| .text-align(right); | |
| } | |
| .text-right { |
This file contains hidden or 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
| .btn-base-styles { | |
| &:hover, &:focus {/* styles */} | |
| &.black { | |
| background-color: black; | |
| &:hover, &:focus {/* styles */} | |
| } | |
| &.red { | |
| background-color: red; | |
| &:hover, &:focus {/* styles */} | |
| } |
This file contains hidden or 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
| @classes: apple, pear, coconut, orange; | |
| .make-chain(@classes); | |
| .make-chain(@list, @i: 1) | |
| when (@i <= length(@list)) { | |
| @name: extract(@list, @i); | |
| &:not(@{name}) { | |
| .make-chain(@classes, @i + 1); | |
| } | |
| } |