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

Introducing custom syntaxes


W3Schools defines a CSS syntax as follows:

"A CSS rule-set consists of a selector and a declaration block: The selector points to the HTML element you want to style. The declaration block contains one or more declarations separated by semicolons."

We as developers spend many hours crafting sites; this can be something small as a one-page contact card-type site, right through to a large e-commerce website. It does not matter which styles we decide to use, or how we get there: the key is that the final result must use the same standard syntax that we've grown to love over the years.

This does not mean to say that our source should be standard CSS, in fact, it would be very restrictive if this were the only option! We could use libraries such as SASS or Less, but instead, how about using the API and custom syntax plugins to manipulate our styles directly? We touched on some of the principles back in Chapter 8, Creating PostCSS Plugins; it's time to revisit this and...