One of the key benefits of using PostCSS is its modular approach—we're not forced to use a large library, particularly if we only need to make use of a small part of its functionality! In this chapter, we'll pull together some of the themes we've discussed throughout earlier chapters, and create a fully working preprocessor, customized to our needs.
We'll use it to compile code for a simple site, explore using it for CMS systems such as WordPress, then take a look at extending it to work with frameworks such as CSStyle. We will cover a number of topics throughout this chapter, which will include the following:
Let's make a start!
Many developers who work with existing processors such as SASS, less, or Stylus will be accustomed to working with a library that is a necessary dependency, and where it is unlikely that they will be using 100% of the functionality available for their chosen processor.
This is not the case with PostCSS. One of the key attractions is its flexibility; gone are the days when we have excess baggage in our processor that is redundant for our needs! The power of flexibility can also be a shortcoming, where does one start deciding what to include in our processor, I hear you ask?
Throughout the course of this chapter, we will bring together the various elements of the processor we've used in the demos, and work through changes we can make to improve or extend functionality. The key, though, to any processor is that there is no right or wrong answer; each will be different, and they will depend on your requirements.
As time goes by, it is likely that you will find common elements that can be reused between projects, ultimately, it is up to you as the developer to find the combination that meets your requirements. This aside, let's begin with a detailed look at the processor we've used in recent examples, and explore some of the ideas and tips we can use to create our own version.