cssnano/cssnano

pack same CSS media query rules into one media query rule

Open

#111 创建于 2016年1月27日

在 GitHub 查看
 (34 评论) (19 反应) (0 负责人)CSS (324 fork)batch import
enhancementhelp wanted

仓库指标

Star
 (4,909 star)
PR 合并指标
 (平均合并 9小时 18分钟) (30 天内合并 14 个 PR)

描述

.foo {
  width: 10px;
}

@media (min-width: 640px) {
  .foo {
    width: 150px;
  }
}

.bar {
  width: 20px;
}

@media (min-width: 320px) {
  .bar {
    width: 200px;
  }
}

@media (min-width: 640px) {
  .bar {
    width: 300px;
  }
}

Output:

.foo{width:10px}@media (min-width:640px){.foo{width:150px}}.bar{width:20px}@media (min-width:320px){.bar{width:200px}}@media (min-width:640px){.bar{width:300px}}

But we can merge @media (min-width:640px). https://github.com/hail2u/node-css-mqpacker he knows how to do it. Maybe add it to the kernel, or to implement the same behavior in one of the plugins. Also pay attention to the option sort.

贡献者指南