【问题标题】:Sort Stylus content对触控笔内容进行排序
【发布时间】:2015-07-09 21:57:23
【问题描述】:

有没有办法按照某些标准对 Stylus 文件中的行进行排序,例如按字母顺序,还是按规则域,比如,所有背景的东西一个接一个地放,然后都是定位的东西,比如topright等等? 当然,这些行应该保留在它们的父元素内。 这是一个例子:

#topbar
    clearfix()
    position fixed
    height topBarHeight
    border-bottom 1px solid rgba(#fff, 0.2)
    box-sizing border-box
    z-index 200
    right 0
    left 0

可以变成这个,按域分组:

#topbar
    // mixins
    clearfix()
    // positioning and sizing
    position fixed
    z-index 200
    left 0
    right 0
    box-sizing border-box
    height topBarHeight
    // border
    border-bottom 1px solid rgba(#fff, 0.2)
    // the rest
    ...

这是一种完美主义之痒,但将所有文件内容按某种顺序排列会很酷。

【问题讨论】:

    标签: html css sorting coding-style stylus


    【解决方案1】:

    如果您希望在手写笔源文件中对行进行排序,我建议您使用可编写脚本的文本编辑器(如 vim)的脚本。如果您希望优化输出,可以使用一些 postcss 插件。你可能想看看 postcss-sortpostcss-merge-rules。如果您使用关键字“合并”,您会发现更多。

    【讨论】:

      猜你喜欢
      • 2016-05-17
      • 2011-01-24
      • 1970-01-01
      • 2012-05-16
      • 2013-06-07
      • 2011-03-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多