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 image sprites


Let's start with something easy: I'm sure that at some point you will either have used or created image sprites, right? If you're a SASS developer, no doubt you will have availed yourself of the sprite mixins from Compass, and used an app such as Koala to compile, or compiled directly from the command line.

Note

A copy of the relevant files for creating sprites using Compass can be found in the code download that accompanies this book, in the Tutorial21A folder.

The process is relatively straightforward, but you still have to set up a Compass project, install a GUI application (if you're using one), and so on, which is a real pain! We could use an online application such as SpritePad (http://spritepad.wearekiss.com/) instead, but again that's a manual process, and it's prone to error. Instead, we can easily use PostCSS to help us here —over and above the normal variables that we declare at the top of any gulp file, there is very little required in order to produce basic...