An efficient way to merge 2 large CSS files

2019-03-13 08:27发布

问题:

I'm looking for a tool that allows you to merge 2 large CSS files. All the ones I've tried so far (like CSSMerge) haven't worked out. Some of them just randomly remove properties. Others choke on the non-standard properties like -webkit and -moz and give me errors. And I also need something that preserves the case of each rule. CSSMerge changed all rules to lower-case.

回答1:

Try

CSS Compressor & Minifier

It have lots of options, you can compress and/or minify css.

  • Copy both CSS files into CSS input
  • Turn on Sort selectors and properties
  • Obtain output
  • Manually remove duplicates
  • Re-enter input
  • compress or minify your output


回答2:

Try SASS, you'll need ruby, but it's awesome for CSS generally. It will merge props though, as well as all it's other awesomeness.