- Mastering PostCSS for Web Design
- Alex Libby
- 152字
- 2021-07-14 11:12:22
Chapter 2. Creating Variables and Mixins
A question: how often have you created components such as buttons, where you've used very similar colors multiple times throughout your code? It's a real pain to manually alter. Using a preprocessor such as SASS or Less makes it easier, but with the overhead of a full-sized library.
Can we do it differently? Absolutely; throughout the next few chapters, we'll explore different elements of PostCSS, before pulling it all together to produce a preprocessor application later in the book. We'll begin our journey with a look at using variables and mixins; we'll explore the basics of creating them first, before transitioning to support using PostCSS. In this chapter, we'll cover the following topics:
- An overview of creating variables and mixins using existing preprocessors
- Transitioning to using PostCSS equivalents
- Adding mixin support to PostCSS
- Examining the differences between standard preprocessors and PostCSS
Let's get cracking!