Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is scss backwards compatible with less?

Tags:

css

sass

less

Is scss backwards compatible with less? I didn't think it was. For example, less prefixes variables with '@' whereas scss prefixes variables with '$'. But even if I replaced the variable prefix, I think there are certain functions/handling specific to each respective preprocessor.

A coworker was insisting that scss is backwards compatible with less. I'm thinking that he may have been confused. Less/scss is backwards compatible with css but I don't think that scss is backwards compatible with less. Can you please confirm?

like image 449
details1 Avatar asked Dec 11 '25 21:12

details1


1 Answers

For basic nested styling, LESS and Sass are generally compatible:

a {
    // A styles

    B {
        // B styles
    }

}

will compile to the same thing in both, and some built-in functions will give the same result.

But after that things are quite different. & behaves differently; Sass uses explicit @mixin mixins while in LESS all class definitions are mixins; the built-in functions are different; Sass has if, for, each and while directives, while LESS relies on when guards and mixins that recall themselves; etc.


For your reference

  • LESS documentation is here http://lesscss.org/features/#features-overview-feature
  • Sass documentation is a little trickier to navigate, but key pages are http://www.sass-lang.com/documentation/file.SASS_REFERENCE.html and http://sass-lang.com/documentation/Sass/Script/Functions.html
like image 79
henry Avatar answered Dec 14 '25 14:12

henry



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!