csscompressioncsstidy

CSSTidy breaking font-face


I am having some issues with CSSTidy breaking my font-face declarations and not sure what the problem is. Originally I was compressing server-side, but also tried running it through an online utility to test. They both have the same output, only the first declaration is included.

I should also call out that the original CSS (input) works fine, just trying to compress it.

INPUT:

@font-face {
    font-family: 'FuturaBT-Light';
    src: url('26A674_0_0.eot');
    src: url('26A674_0_0.eot?#iefix') format('embedded-opentype'),
        url('26A674_0_0.woff') format('woff'),
        url('26A674_0_0.ttf') format('truetype');
    }
@font-face {
    font-family: 'FuturaBT-Book';
    src: url('26A674_1_0.eot');
    src: url('26A674_1_0.eot?#iefix') format('embedded-opentype'),
        url('26A674_1_0.woff') format('woff'),
        url('26A674_1_0.ttf') format('truetype');
    }
@font-face {
    font-family: 'FuturaBT-Medium';
    src: url('26A674_2_0.eot');
    src: url('26A674_2_0.eot?#iefix') format('embedded-opentype'),
        url('26A674_2_0.woff') format('woff'),
        url('26A674_2_0.ttf') format('truetype');
    }
@font-face {
    font-family: 'FuturaBT-Bold';
    src: url('26A674_3_0.eot');
    src: url('26A674_3_0.eot?#iefix') format('embedded-opentype'),
        url('26A674_3_0.woff') format('woff'),
        url('26A674_3_0.ttf') format('truetype');
    }

OUTPUT:

@font-face
{
    font-family:FuturaBT-Bold;
    src:url(26A674_3_0.eot?#iefix) format(embedded-opentype), url(26A674_3_0.woff) format(woff), url(26A674_3_0.ttf) format(truetype);
}

Solution

  • It looks like CSSTidy is using CSS level 2.1 spec, which doesn't include the src property. I would suggest using another compression tool such as the clean-css node module, or for an online compression tool try https://csscompressor.net/