- Mastering PostCSS for Web Design
- Alex Libby
- 295字
- 2021-07-14 11:12:27
Summary
Over the years, developers have had to frequently write code that duplicates all or part of a selector—a perfect example is styling lists or navigation items. It's a real pain to have to write so much extra code; instead we can use nesting principles to help remove some of this code. We've covered a number of techniques around nesting in PostCSS throughout this chapter, so let's take a moment to review what we've learned.
We kicked off with an introduction to nesting, to help bring us up to speed, before launching into using the postcss-nesting
plugin to create nested styles within PostCSS. We then moved on to creating our nesting demo. We began with preparing a plain vanilla CSS version, before taking a look at converting to existing processors such as SASS.
Moving on, we then took a look at converting our code using the postcss-nesting
plugin, before exploring some of the pitfalls that are associated with nesting, and some of the tips and tricks we can use to reduce CSS specificity, one of the key issues associated with nesting.
We then rounded out the chapter with a look at BEM, and how it can be used in PostCSS. We covered some of the basic principles of this methodology, before applying it to a simple example. We also learned why it won't always work for every instance; for those where it is suitable, we took a brief look at how we can set PostCSS to automatically lint our BEM code.
Phew, a real whistle stop tour there! Hang on to your hats though, as it won't stop: in our next chapter, we're going to take a look at writing media queries, and how PostCSS can help with compiling them into valid CSS.
- 現(xiàn)代C++編程:從入門到實(shí)踐
- Java程序設(shè)計(jì)(慕課版)
- CentOS 7 Linux Server Cookbook(Second Edition)
- Java編程指南:基礎(chǔ)知識、類庫應(yīng)用及案例設(shè)計(jì)
- 云原生Spring實(shí)戰(zhàn)
- Visual C++應(yīng)用開發(fā)
- 劍指大數(shù)據(jù):企業(yè)級數(shù)據(jù)倉庫項(xiàng)目實(shí)戰(zhàn)(在線教育版)
- 軟件測試綜合技術(shù)
- SQL Server 2008 R2數(shù)據(jù)庫技術(shù)及應(yīng)用(第3版)
- 編程改變生活:用Python提升你的能力(進(jìn)階篇·微課視頻版)
- JavaScript機(jī)器人編程指南
- Xamarin Cross-Platform Development Cookbook
- Microsoft Exchange Server 2016 PowerShell Cookbook(Fourth Edition)
- MySQL核心技術(shù)與最佳實(shí)踐
- Spark for Data Science