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

Guidelines for plugin building


One of the key benefits of the PostCSS ecosystem is its flexibility—it allows any developer to create any plugin, or adapt existing ones, as long as the license allows for further development!

To help retain a sense of consistency, the developer has issued a series of mandatory guidelines, which should be followed where practical:

  • The name of your plugin should clearly indicate the purpose of that plugin—for example, if you built one to mimic the CSS4 :hover pseudo-class, then postcss-hover would be a good example.

  • It is better to create a plugin that does one thing well, and not one that tries to perform multiple tasks at the same time.

  • Always use the postcss.plugin method when creating plugins—you are then hooking into a common plugin API.

  • Where possible, try to use asynchronous methods—you should also set a node.source for each node, so that PostCSS can generate an accurate source map.

  • Do not use the console when displaying errors—some PostCSS runners do not allow...