1.首先安装ruby下载地址https://rubyinstaller.org/2。安装sass和compassgem安装sassgem安装compass3。创建scss文件@charset"utf-8";//变量$text-color:#000;//通用样式@mixinel1{text-overflow:ellipsis;-o-文本溢出:省略号;-ms-文本溢出:省略号;溢出:隐藏;空白:nowrap;}//方法@mixinborder-radius($width){border-radius:$width;-webkit-边框半径:$宽度;-moz-边界半径:$宽度;-o-边界半径:$宽度;$宽度;}//继承(缺点:编译后css出现在外面).commonText{font-size:22px;字体粗细:900;}//Placeholder(和继承的区别是不会在这个css外面出现)%mt15{margin-top:15px;}body{.box{@extend.commonText;//继承使用@extend%mt15;//占位符使用@includeborder-radius(5px);//该方法使用@includeel1;//混合宏使用color:$text-color;//变量使用cursor:pointer;边框:1pxs固体#ccc;宽度:124px;&:hover{颜色:红色;}}}4。编译监控scss文件sass--watchindex.scss:index.css5。很高兴使用css文件
