DEV Community

Vladimir Schneider
Vladimir Schneider

Posted on

Automate cleaning css rules

Hi, dev.to community!

Today I researched normalize.css and I thought about how I could improve css files of plugins.

Each of us wrote css rules for specific browsers and if change supported browsers list for a project the rules remain in code. You may search it and remove, but it so slowly.

Problems that can be solved:

  1. your css rules and css of plugins if current project does not support this browser will have been removed
  2. If you change supported browsers css rules will have been removed too

I think about a tool for automate it.

For example input:

/* only for: IE 10 */
template {
  display: none;
}

a {
  color: red;
}
Enter fullscreen mode Exit fullscreen mode

and output will be

a {
  color: red;
}
Enter fullscreen mode Exit fullscreen mode

I can do it as PostCSS plugin and check browserslist for compares.

What do you think about it?

Top comments (0)