rstacruz / css-condense

[unsupported] A CSS compressor that shows no mercy
205 stars 4 forks source link

Multiple font-face definitions should not be merged #2

Closed geirlandro closed 12 years ago

geirlandro commented 12 years ago

css-condense is merging multiple font-face definitions. Each webfont needs to be in a separate @font-face {} for it to work.

So if I have this:

@font-face {
  font-family: 'font1';
  src: url('font1.eot?') format('eot'), url('font1.woff') format('woff'), url('font1.ttf') format('truetype');
}
@font-face {
  font-family: 'font2';
  src: url('font2.eot?') format('eot'), url('font2.woff') format('woff'), url('font2.ttf') format('truetype');
}

cssc condenses it to

@font-face{font-family:font1;font-family:font2;src:url(font1.eot?) format('eot'),url("font1.woff") format('woff'),url("font1.ttf") format('truetype');src:url(font2.eot?) format('eot'),url("font2.woff") format('woff'),url("font2.ttf") format('truetype')}

When it should be:

@font-face{font-family:font1;src:url(font1.eot?) format('eot'),url("font1.woff") format('woff'),url("font1.ttf") format('truetype')}
@font-face{font-family:font2;src:url(font2.eot?) format('eot'),url("font2.woff") format('woff'),url("font2.ttf") format('truetype')}
rstacruz commented 12 years ago

Oops. Fixed!

rstacruz commented 12 years ago

@font-face rules are being left alone for now (nothing happens inside a font-face rule). eventually, i want to make the @font-face rules always be on top of the file (helps gzip, hypothetically), and clean up duplicate @font-face rules.

rstacruz commented 12 years ago

Okay, implemented that as well. now @font-face rules will always be on top of the document. Also: