Skip to main content

Tedshd's Dev note

gulp - One problem i found when i use CSS minify with some CSS library

Table of Contents

# gulp - One problem i found when i use CSS minify with some CSS library

When i use pure.

And i use gulp as my front-end build tool.

I used cssmin as my CSS minify tool.

By default it can extreme compress CSS file.

The one problem happen!

螢幕快照 2016-08-31 下午4.07.02.png

display not match

Because use CSS minify can remove inherited CSS property.

So in webkit browser doesn’t has display: -webkit-flex; and layout will be an error.

But this is not a bug, it is a feature.

It can avoid inherited CSS property and it can decrease CSS file size.

But in this case, it is not good feature.

So i need add option in my gulp file.

cssmin({
    aggressiveMerging: false
})

It represent to aggressive merging of CSS properties.