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

Working with SVG in PostCSS


The rapidly increasing use of mobile devices makes creating responsive content a must; the traditional route is using something akin to max-width: 100% to control the size of an element on screen.

A better alternative is to use SVG—this maintains quality, even when resized; standard image formats will become pixelated if resized to an excessive size. For those of you who have previously used SASS, then there isn't any in-built support for SVG as such; the most we can hope to achieve is efficient nesting within our style sheet.

An example of what we might use can be found in the sass folder within the Tutorial22 folder in the code download that accompanies this book.

If we're a regular user of SVG images within SASS, then it is likely we would use a library such as sass-svg, from https://github.com/davidkpiano/sass-svg. Moving away from SASS to PostCSS is easy; the PostCSS ecosystem has a number of plugins we can use to manipulate images. Let's take a look at how...