cssnano/cssnano

pack same CSS media query rules into one media query rule

Open

#111 建立於 2016年1月27日

在 GitHub 查看
 (34 留言) (19 反應) (0 負責人)CSS (4,909 star) (324 fork)batch import
enhancementhelp wanted

描述

.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.

貢獻者指南