E
E
eellazy2016-09-09 12:42:10
css
eellazy, 2016-09-09 12:42:10

How to optimize css code?

Hello! Wrote a very large file with styles for the site. Wrote if only as that is, in a quick hand. Now I want to optimize it.
Is this considered an optimization if it was margin-top: 10px; margin-bottom:5px; and it became margin: 10px 0px 5px;

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
metaf, 2016-09-09
@metaf

An optimization can be seen as removing duplicate styles/selectors and sequencing the selectors correctly. Then take css lint or scss lint, find the config that suits you and clean everything.
And these incomprehensible zeros from combining padding margins can play a cruel joke on you.

M
Michael, 2016-09-09
@mak_ufo

Yes
Also focus on unnecessary classes, wrappers and css styles

I
iBird Rose, 2016-09-09
@iiiBird

run your css through gulp shorthand https://github.com/vol7/shorthand
and also through gulp-csso https://github.com/ben-eb/gulp-csso

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question