When comparing Less vs Sly, the Slant community recommends Less for most people. In the question“What are the best CSS preprocessors/postprocessors?” Less is ranked 3rd while Sly is ranked 8th. The most important reason people chose Less is:
Because Less has a lightweight feature set, is syntactically similar to CSS and can be run client side with file conversion on a page reload, it is easy to pick up by anyone familiar with CSS & the very basics of JS. Also, Less has detailed and well-organized documentation, GUI apps that can watch and compile code for you and a huge, active and helpful community.
Ranked in these QuestionsQuestion Ranking
Pros
Pro Easy to learn
Because Less has a lightweight feature set, is syntactically similar to CSS and can be run client side with file conversion on a page reload, it is easy to pick up by anyone familiar with CSS & the very basics of JS.
Also, Less has detailed and well-organized documentation, GUI apps that can watch and compile code for you and a huge, active and helpful community.
Pro Familiar CSS style syntax
The LESS syntax is essentially the same as CSS with extensions for dynamic behavior such as variables, mixins, operations and functions.
Variables:
@color: #4D926F;
#header {
color: @color;
}
h2 {
color: @color;
}
Mixins:
.rounded-corners (@radius: 5px) {
-webkit-border-radius: @radius;
-moz-border-radius: @radius;
-ms-border-radius: @radius;
-o-border-radius: @radius;
border-radius: @radius;
}
#header {
.rounded-corners;
}
#footer {
.rounded-corners(10px);
}
Nested Rules:
#header {
h1 {
font-size: 26px;
font-weight: bold;
}
p { font-size: 12px;
a { text-decoration: none;
&:hover { border-width: 1px }
}
}
}
Pro Modern features and mixins
Less contains the base feature-set for a CSS preprocessor:
- Nesting
- Variables
- Basic mathematical operations
- Color functions
- @import
- Basic type functions
Pro Popular
Less is one of the most popular preprocessors due to being the easy to learn and its use in Twitter Bootstrap.
Pro Less is written in JavaScript
Many web developers are familiar with JavaScript and because Less is written in JS, it can be processed client side making the set-up easy.
Pro GUI apps
Apps such as Crunch, SimpLESS, WinLess, Koala, CodeKit, LiveReload or Prepros will watch and compile less.js for you.
Pro Good IDE support
IDEs such as VS Code, Visual Studio and WebStorm (and other JetBrains IDEs) support LESS either natively or through plugins.
Pro Readable syntax
By using whitespaces and nesting, you don't need braces or semicolons. This helps with keeping the syntax as readable and minimal as possible.
Pro Supports variables out of the box
Sly has out of the box support for variables.
Cons
Con Less uses '@' to declare variables
The '@' symbol is used with Less to declare variables. However '@' already has meaning in CSS, as it is used to declare @media queries and @keyframes. This can result in some confusion when reading the code.
Con calc() requires interpolation
Con Limited support of conditionals
Less currently has limited support of conditionals such as ternary operators.
Con No custom functions
Less does not offer custom functions and instead requires the use of mixins. This is limiting in many ways - Functions cannot be called on shorthand values, they cannot return a value, and code needs to be repeated depending on where the mixin is needed.
Con Noisy syntax
Many unnecessary characters such as the following:
{}:;@
Con No loop and conditionals block
Con Extremely limited adoption
Sly has just 5 stars on Github and a very small adoption rate. For an open source project this usually means less bugs reported, lesser documentation and few third-party learning resources.
Con Not stable
Sly is in the alpha stage.