4种Sass的输出格式

74ca7659fde37532966003e2809c1a58.jpeg

输出格式说明

Sass编译输出的css格式可以自定义。

有4种输出格式:

  • :nested – 音乐格式

  • :expanded – 展开格式

  • :compact – 简化格式

  • :compressed – 压缩格式

默认格式是:嵌套。

使用风格可以设置选项或使用风格参数设置输出格式。

命令标准格式:

 
 
sass  --watch   (scss文件):(要生成的目标css文件)  --style  (输出格式)

例如:

 
 
sass --watch index.scss:index.css --style compressed

不同格式输出

我们把各种不同格式的输出,看不同输出格式的区别:

 
 
html{
    font-size: 12px;
    color: #333;}.container{
    font-size: 14px;
    .header{
        width: 50%;
        height: 30px;
        .left{
            float: left;        }    }    .footer{
        background-color: green;    }    &::after{
        display: inline-block;    }}

嵌套 – 格式

 
 
html {
  font-size: 12px;
  color: #333; }.container {
  font-size: 14px; }
  .container .header {
    width: 50%;
    height: 30px; }
    .container .header .left {
      float: left; }
  .container .footer {
    background-color: green; }
  .container::after {
    display: inline-block; }

展开 – 展开格式

 
 
html {
  font-size: 12px;
  color: #333;}.container {
  font-size: 14px;}.container .header {
  width: 50%;
  height: 30px;}.container .header .left {
  float: left;}.container .footer {
  background-color: green;}.container::after {
  display: inline-block;}

紧凑格式——多格式

 
 
html { font-size: 12px; color: #333; }.container { font-size: 14px; }.container .header { width: 50%; height: 30px; }.container .header .left { float: left; }.container .footer { background-color: green; }.container::after { display: inline-block; }

压缩 – 压缩格式

 
 
html{font-size:12px;color:#333}.container{font-size:14px}.container .header{width:50%;height:30px}.container .header .left{float:left}.container .footer{background-color:green}.container::after{display:inline-block}

总结

通过观察不同的输出格式,可以将结果格式设置为发布格式,压缩转出的文件是最小开发的,所以该格式通过项目时更好地组合,通过设置为阶段格式可以为紧凑,也可以设置,根据自己的心情来设置。

这就是sass的四种转出格式的详细介绍。

学习更多技能

请点击下方公众号

0b5fabed8b8b4f7af3e82bd7e9248ee8.gif

865f8e8b2a19a71ce6895b972484677a.jpeg

57c9d40646105acb6ddcda14107041e5.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值