Lately, I practically didn’t do any layout, and I missed the output of Sass3, in which the SCSS extension ( S assy CSS ) is implemented. This is exactly an extension for CSS without syntax “distortion” - that is, any valid CSS document is also a fully valid SCSS document. In the post I will compare with existing preprocessors such as Sass and Less . About which it was already written on Habré: Sass , Less . But that information is a bit outdated: in particular, the Sass syntax has changed.$blue: #3bbfce
$margin: 16px
.border
padding : $margin / 2
margin : $margin / 2
border-color : $blue
@brand_color: #4D926F ;
#header {
color : @brand_color;
}
$blue: #3bbfce ;
$margin: 16px ;
.border {
padding : $margin / 2 ;
margin : $margin / 2 ;
border-color : $blue;
}
table .hl {
margin : 2em 0 ;
}
table .hl td .ln {
text-align : right ;
}
table .hl {
margin : 2em 0 ;
td .ln {
text-align : right ;
}
}
table .hl
margin : 2em 0
td .ln
text-align : right
.clearfix:after {
content : "." ;
display : block ;
clear : both ;
visibility : hidden ;
line-height : 0 ;
height : 0 ;
}
.clearfix {
display : inline-block ;
}
html[xmlns] .clearfix {
display : block ;
}
* html .clearfix {
height : 1% ;
}
<div class = "clearfix" >
.rounded_corners ( @radius : 5px ) {
-moz-border-radius : @radius ;
-webkit-border-radius : @radius ;
border-radius : @radius ;
}
#header {
.rounded_corner ;
}
#footer {
.rounded_corners ( 10px );
}
@mixin rounded_corners ( $radius ) {
-moz-border-radius : $radius ;
-webkit-border-radius : $radius ;
border-radius : $radius ;
}
#footer {
@include rounded_corners ( 10px );
}@mixin rounded_corners ( $radius )
-moz-border-radius : $radius
-webkit-border-radius : $radius
border-radius : $radius
#footer
@include rounded_corners ( 10px )
@the-border: 1px ;
#header {
border-left : @the-border;
border-right : @the-border * 2 ;
}$the-border: 1px ;
#header {
border-left : $the-border;
border-right : $the-border * 2 ;
}$the-border: 1px
#header
border-left : $the-border
border-right : $the-border * 2
gem install haml
gem install less
Source: https://habr.com/ru/post/96417/
All Articles