Throughout this chapter, we've explored using PostCSS to compile our media queries; while there are plenty of options open to us in terms of what we create, we should be mindful of what we create, to ensure that we're not creating a monster that slows our site down!
PostCSS has a couple of plugins available to help us here. They are:
postcss-mq-keyframes
: Available at https://github.com/TCotton/postcss-mq-keyframes), this is a simple plugin that moves all keyframes out of existing queries, to the bottom of a style sheet. This allows us to rationalize our keyframe rules—in the event that we have multiple media queries, we can apply the same rule to each of these media queries.For example, the highlighted code below would be moved out of the query, and become a rule in its own right:
@media only screen and (min-width: 415px) { .pace { animation: pace-anim 5s; } @keyframes pace-anim { 100% { opacity
css-mqpacker
: Available at https://github.com/hail2u...