Skip to content

Instantly share code, notes, and snippets.

@jonschlinkert
Created October 31, 2012 20:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonschlinkert/3989438 to your computer and use it in GitHub Desktop.
Save jonschlinkert/3989438 to your computer and use it in GitHub Desktop.
Syntax proposals for "extends" in LESS

Initial proposal

Initial proposal to use +. from @hokaccha:

where this

.foo {
  width: 100px;
}
.bar {
  +.foo;
}

would compile to this:

.foo, bar {
  width: 100px;
}

proposal #2

from @dmcass

@extend

proposal #3

from @DesignByOnyx

h3 {
    font-size: 20px;
    ++.shared;
}

and later:

extend( @selector )

proposal #4

from @agatronic

.shared {
    font-size: 12px;
    color: red;
}

h3 {
    &,.shared;
    font-size: 16px;
}

h2 {
    &.shared;
    font-size: 10px;
}

proposal #5

from @jestho

.foo {
    $.bar;
    border-width: 2px;
}

.foo {
    =.bar;
    border-width: 2px;  
}

.foo {
    %.bar;
    border-width: 2px;  
}

proposal #6

from @cloudhead

.seriousError {
  < .error;
  < .attention;
}

proposal #7

from @jonschlinkert

.seriousError:extend(.error, .attention) {
  ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment