cnpm install --save-dev sass-loader
//sass-loader依赖于node-sass
cnpm install --save-dev node-sass
//实现BEM的模式
.block { color: red;
@at-root #{&}-green{
color: green;
}
//继承
.row {
@extend .fn-clearfix;
}
//循环
@for $i from 1 to 12{
.t#{$i} {
top: ($lh*$i);
}
}
/*栅格*/
$gridColumns: 12 !default;
$gridGutter: 20px !default;
.row {
margin-right: -$gridGutter / 2;
margin-left: -$gridGutter / 2;
@extend .fn-clearfix;
}
%col{
float:left; min-height: 1px;padding-left:$gridGutter / 2; padding-right:$gridGutter / 2;
}
@for $i from 1 through 12 {//to 不包含12
.col-md-#{$i} {
@extend %col;
float: left;
width: $i/$gridColumns*100%;
}
}
$file-types:doc pdf txt xls rar mp4;
@each $type in $file-types{
.#{$type}{
background-image: url(/static/images/#{$type}.png);
}
}