Where does one start, when working with an average WordPress style sheet, I hear you ask?
Well, the first thing we should not do is be put off by its size. Yes, I know this might sound crazy (after all, the Twenty Sixteen theme weighs in at 3920 lines!), but with some planning, we can easily break this into something more manageable.
If we only achieve one task with PostCSS, then that task must be to make use of the postcss-import
plugin to help break our code into more manageable principles. If you happen to have used processors such as SASS or Less, then it's the same principle—in our master style.css
, we can create a series of import statements, and hive off each block into separate files.
Once we've broken the style sheet into more manageable chunks, there are a fair few things we can implement in our code; we should always consider it an iterative process, until such time as we exhaust all possible alternatives, the site is no longer required, or we migrate...