热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

bootstrap的scss源码疑惑

bootstrap的scss源码中有一段代码:

bootstrap的scss源码中有一段代码:



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
@mixin hover {

  // TODO: re-enable along with mq4-hover-shim

//  @if $enable-hover-media-query {

//    // See Media Queries Level 4: https://drafts.csswg.org/mediaqueries/#hover

//    // Currently shimmed by https://github.com/twbs/mq4-hover-shim

//    @media (hover: hover) {

//      &:hover { @content }

//    }

//  }

//  @else {

    &:hover { @content }

//  }

}



@mixin hover-focus {

  @if $enable-hover-media-query {

    &:focus { @content }

    @include hover { @content }

  }

  @else {

    &:focus,

    &:hover {

      @content

    }

  }

}

令我疑惑的是不论变量 $enable-hover-media-query 是 true 还是 false,最后生成的代码效果似乎都是一样的,为什么还需要用 @if @else 分开呢?


   



推荐阅读
author-avatar
vuvhvuvh
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有