Book Image

Mastering PostCSS for Web Design

By : Alex Libby
Book Image

Mastering PostCSS for Web Design

By: Alex Libby

Overview of this book

PostCSS is a tool that has quickly emerged as the future of existing preprocessors such as SASS and Less, mainly because of its power, speed, and ease of use. This comprehensive guide offers in-depth guidance on incorporating cutting-edge styles into your web page and at the same time maintaining the performance and maintainability of your code. The book will show how you can take advantage of PostCSS to simplify the entire process of stylesheet authoring. It covers various techniques to add dynamic and modern styling features to your web pages. As the book progresses, you will learn how to make CSS code more maintainable by taking advantage of the modular architecture of PostCSS. By the end of this book, you would have mastered the art of adding modern CSS effects to web pages by authoring high performing, maintainable stylesheets.
Table of Contents (21 chapters)
Mastering PostCSS for Web Design
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Taking things further with CSS4


One of those small pet hates when working with media queries is that the query itself isn't really semantic; most queries will show something like max-width: 1024px, when we really mean …less than… or …greater than….

Thankfully, with the upcoming changes to CSS in what most people call CSS4, we will be able to use >, <, or = symbols to express what we really mean in our code. The beauty about PostCSS is that we can emulate that functionality now, with the postcss-media-minmax plugin (available at https://github.com/postcss/postcss-media-minmax); the plugin will convert these to the more familiar min- or max- statements that we already know.

It's a really easy plugin to use—we're going to break with convention here though, and use CodePen to demonstrate the plugin in action. CodePen will support a limited number of plugins, of which this is one of them—it's a perfect opportunity to see the effect of our query in action. For our demo, we're going to use...