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

Using the PreCSS library


Okay…so why is it better, I hear you ask?

The simple answer to this is that we can compile SASS-like code directly without using an external library such as libsass. The distinction here, though, is that it works on SASS-like code, not direct SASS.

This isn't an issue though—we can easily perform a search and replace using a text editor to make the minor formatting changes required to make it compatible for PreCSS. The library source is available at https://github.com/jonathantneal/precss; the developer has even provided an online playground for our use, at https://jonathantneal.github.io/precss/, so that we can try out changes before committing to code.

At this point, we're going to break with convention—rather than produce a simple web page, let's push the boat out and use a content management system such as WordPress. Why? Well, for two reasons: WordPress already uses both PostCSS and SASS—it makes perfect sense to continue using the same tools! On this basis,...