Skip to content

Instantly share code, notes, and snippets.

@gka
Created September 17, 2015 21:07
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gka/f2e1342ef02e1f3b5c22 to your computer and use it in GitHub Desktop.
Save gka/f2e1342ef02e1f3b5c22 to your computer and use it in GitHub Desktop.
Converting SASS to LESS
for f in *.sass; sass-convert -F sass -T scss $f > "`basename $f .sass`.less";
@duzun
Copy link

duzun commented Jun 6, 2017

It doesn't really do the right thing, cause SCSS is not always valid LESS,
but it is close.

@Jungtz
Copy link

Jungtz commented Nov 14, 2017

// Margin and Padding

@each $breakpoint in map-keys($grid-breakpoints) {
@include media-breakpoint-up($breakpoint) {
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);

@each $prop, $abbrev in (margin: m, padding: p) {
  @each $size, $length in $spacers {

    .#{$abbrev}#{$infix}-#{$size}  { #{$prop}:        $length !important; }
    .#{$abbrev}t#{$infix}-#{$size} { #{$prop}-top:    $length !important; }
    .#{$abbrev}r#{$infix}-#{$size} { #{$prop}-right:  $length !important; }
    .#{$abbrev}b#{$infix}-#{$size} { #{$prop}-bottom: $length !important; }
    .#{$abbrev}l#{$infix}-#{$size} { #{$prop}-left:   $length !important; }
    .#{$abbrev}x#{$infix}-#{$size} {
      #{$prop}-right: $length !important;
      #{$prop}-left:  $length !important;
    }
    .#{$abbrev}y#{$infix}-#{$size} {
      #{$prop}-top:    $length !important;
      #{$prop}-bottom: $length !important;
    }
  }
}

// Some special margin utils
.m#{$infix}-auto  { margin:        auto !important; }
.mt#{$infix}-auto { margin-top:    auto !important; }
.mr#{$infix}-auto { margin-right:  auto !important; }
.mb#{$infix}-auto { margin-bottom: auto !important; }
.ml#{$infix}-auto { margin-left:   auto !important; }
.mx#{$infix}-auto {
  margin-right: auto !important;
  margin-left:  auto !important;
}
.my#{$infix}-auto {
  margin-top:    auto !important;
  margin-bottom: auto !important;
}

}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment