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

Creating an transition plugin


The idea for this plugin is not new; it's loosely based on the postcss-transform-shortcut plugin by Jonathan Neal, available from https://github.com/jonathantneal/postcss-transform-shortcut. The concept is not necessarily a shorter means to create transition statements, but it makes it easier by allowing authors to specify values independently. These are then automatically inserted into the correct order within the transition declaration.

Note

The source code for this plugin is also available on GitHub, at https://github.com/alexlibby/postcss-transition-shortcut; the NPM package is also available at https://www.npmjs.com/package/postcss-transition-shortcut.

Let's dive in and take a look at how it is put together, in more detail:

  1. We'll start by installing Git—this is required for installing the plugin boilerplate. To do this, browse to https://git-scm.com/book/en/v2/Getting-Started-Installing-Git, and follow the instructions for your platform.

  2. Open a Node.js command...