首页 新闻 会员 周边

css拓展语言stylus

0
悬赏园豆:50 [已解决问题] 解决于 2020-03-20 10:36

stylus代码

functions = constant env
safe-area-fn(fn, position)
  s("%s(safe-area-inset-%s)", fn, position)
safe-area-mixin(property, position, important = false)
  for fn in functions
    {property} safe-area-fn(fn, position) important == true ? !important : unquote("")

.cube-safe-area-pb {
  safe-area-mixin(padding-bottom, bottom, true);
}

编译后的css代码:

.cube-safe-area-pb{
  padding-bottom:constant(safe-area-inset-bottom)!important;
  padding-bottom:env(safe-area-inset-bottom)!important
}

求问这段styl代码什么意思,我现在将这段stylus代码,转换为scss,该怎么写

css
U型枕的主页 U型枕 | 菜鸟二级 | 园豆:231
提问于:2020-03-19 14:45
< >
分享
最佳答案
0

https://github.com/txs1992/stylus-converter
stylus 转换为 sass 或 less 的工具

$functions: constant env;
@function safe-area-fn($fn, $position) {
  @return s("%s(safe-area-inset-%s)", $fn, $position);
}
@function safe-area-mixin($property, $position, $important: false) {
  @each $fn in $$functions {
    @return #{$property}: safe-area-fn($fn, $position), $important==true;
  }
}
.cube-safe-area-pb {
  @include safe-area-mixin(padding-bottom, bottom, true);
}
收获园豆:50
css design | 菜鸟二级 |园豆:215 | 2020-03-20 10:00

感谢

U型枕 | 园豆:231 (菜鸟二级) | 2020-03-20 10:37

你好,这个工具编译出来的scss是报错的

$functions: constant env;
@function safe-area-fn($fn, $position) {
  @return s("%s(safe-area-inset-%s)", $fn, $position);
}
@function safe-area-mixin($property, $position, $important: false) {
  @each $fn in $$functions {
        @return #{$property}:     safe-area-fn($fn, $position),     $important == true;
  }
}
.cube-safe-area-pb  {
  @include safe-area-mixin(padding-bottom, bottom, true);
}

在sassmeister测试怎么也不会改,求大佬帮忙看看

U型枕 | 园豆:231 (菜鸟二级) | 2020-03-23 12:27
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册