Mastering PostCSS for Web Design
图书信息
| 作者 | Alex Libby |
| 出版社 | Packt Publishing |
| ISBN | 9781785885556 |
| 出版时间 | 2016-06-01 |
| 字数 | 236.4万 |
| 分类 | 进口书,外文原版书,电脑,网络 |
读书简介
Explore the power of PostCSS to write highly performing, modular, and modern CSS code for your web pages About This Book Incorporate cutting-edge styles in your web pages with PostCSS Simplify the process of writing CSS to a great extent using PostCSS shortcuts, fallbacks, and pack plugins This in-depth, step-by-step guide will help you master PostCSS, to create amazing and responsive web designs Who This Book Is For This book is ideal for web developers and designers who are comfortable with HTML5 and CSS and now want to master PostCSS for web design. Web designers who have been using SASS or Less and now want to adopt PostCSS would also find this book useful. What You Will Learn Add mixin and variable support to PostCSS along with conditional support Explore the different ways of nesting code such as BEM and standard nesting within PostCSS Optimize media queries built with PostCSS to get the best performance Add dynamic styling elements such as images, fonts, grids, and SVG and retina support using existing preprocessors as well as PostCSS Get familiar with using plugins, and extend PostCSS with the API Build a fully working custom preprocessor and test it on different sites such as WordPress Write a custom syntax in PostCSS while still using pre-built syntaxes such as Less, SASS, or Stylus Provide support for future CSS such as CSS4 using current CSS3 classes In Detail 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. Style and approach This comprehensive book provides in-depth guidance on how to build a PostCSS powered responsive site from scratch. Following a step-by-step approach, you will learn how to add modern styles to web pages. It also contains several tips and best practices on how you can optimize your sites by writing high performing code in PostCSS.
目录
Mastering PostCSS for Web Design
Table of Contents
Mastering PostCSS for Web Design
Credits
About the Author
About the Reviewer
www.PacktPub.com
eBooks, discount offers, and more
Why subscribe?
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Introducing PostCSS
Discovering the art of processing
Introducing PostCSS
Exploring the benefits of using PostCSS
Considering some of the pitfalls
Clearing up some misconceptions
Preparing for exercises in this book
Setting up a development environment
Installing PostCSS
Creating a simple example using PostCSS
Adding source map support
Creating minified style sheets
Altering to compile automatically
Linting code using plugins
Exploring how PostCSS works
Making the move from SASS
Summary
2. Creating Variables and Mixins
Introducing variables and mixins
Setting up SASS
Creating a hover effect example
Using Less CSS as an alternative
Transitioning to using PostCSS
Adding variable support to PostCSS
Updating our hover effect demo
Taking it a step further
Setting the order of plugins
Creating mixins with PostCSS
Updating our hover effect demo
Comparing PostCSS to standard processors
Looping content with PostCSS
Iterating through @each statements
Switching to using PostCSS
Summary
3. Nesting Rules
Introducing nesting
Navigating through pages
Preparing our demo
Converting from existing processors
Transitioning to using PostCSS plugins
Converting our demo to PostCSS
Compiling our code
Exploring the pitfalls of nesting
Taking a better approach
Reconsidering our code
Updating our code
Making the switch to BEM
Creating simple message boxes
Compiling and linting our code
Installing BEM support
Exploring our changes in more detail
Fixing our errors
Summary
4. Building Media Queries
Revisiting media queries
Exploring custom media queries in PostCSS
Beginning with plain CSS
Altering our demo to use PostCSS
Making images responsive
Making an image responsive with PostCSS
Implementing responsive capabilities to images
Adding support for retina images
Taking the next steps
Exploring other media possibilities
Adding responsive text support
Optimizing media queries
Retrofitting support for older browsers
Moving away from responsive design
Taking things further with CSS4
Summary
5. Managing Colors, Images, and Fonts
Adding color, fonts, and media to sites
Maintaining asset links
Automating links to assets
Managing fonts with PostCSS
Creating image sprites
Demo – creating a credit card icon bar
Working with SVG in PostCSS
Altering icon images using PostCSS
Exploring the results in more detail
Considering alternative options
Adding support for WebP images
Switching WebP images in and out
Viewing the differences in file sizes
Manipulating colors and color palettes
Displaying and mixing colors using palettes
Dissecting our demo in more detail
Creating color functions with PostCSS
Adjusting colors using functions
Dissecting our demo
Creating colors with PostCSS filters
Exploring our demo in more detail
Comparing with CSS3 filters
Adding Instagram effects to your images
Summary
6. Creating Grids
Introducing grid design
Automating the compilation process
Adding support for Bourbon Neat
Creating an example with Bourbon Neat
Exploring our demo in more detail
Exploring the grid plugins in PostCSS
Transitioning to using PostCSS-Neat
Refining our task list
Testing our configuration
Creating a site using Neat and PostCSS
Making the change to PostCSS
Adding responsive capabilities
Correcting the design
Summary
7. Animating Elements
Revisiting basic animations
Moving away from jQuery
Animating content with Transit.js
Animating with plain JavaScript
Switching classes using jQuery
Making use of pre-built libraries
Dissecting the code for our demo
Switching to using SASS
Creating an animated gallery
Adding the finishing touches
Making the switch to PostCSS
Exploring plugin options within PostCSS
Updating code to use PostCSS
Testing our altered code
Creating a demo in PostCSS
Updating the plugin
Building our demo
Dissecting our demo in more detail
Optimizing our animations
Using our own animation plugin
Exploring the plugin in more detail
Summary
8. Creating PostCSS Plugins
Extending PostCSS with plugins
Dissecting the architecture of a standard plugin
Exploring index.js
Discovering package.json
Exploring test.js
The Vendor module
The List module
Classes available in the API
Nodes available in the API
Methods available in the API
Creating an transition plugin
Creating a test for our plugin
Correcting the errors
Clearing the final error
Performing a test using the plugin
Dissecting our plugin in detail
Building a custom font plugin
Dissecting the functionality of our plugin
Exploring the dangers of publishing this plugin
Simplifying the development process
Guidelines for plugin building
Making the plugin available for use
Summary
9. Working with Shortcuts, Fallbacks, and Packs
Using shortcut plugins in PostCSS
Exploring plugin packs for PostCSS
Writing styles in shorthand
Adding shortcuts with Rucksack
Introducing our demo
Installing Rucksack as a plugin
Easing into using Rucksack
Animating content using the plugin
Dissecting our demo in more detail
Converting our slider to use Rucksack
Dissecting our code
Linting and optimizing your code
Exploring the use of cssnano
Configuring Stylelint as our linter
Providing fallback support
Detecting support for features
Providing support for oldie
Removing style hacks from code
Summary
10. Building a Custom Processor
Creating your processor
Exploring our processor
Dissecting the package.json file
Exploring the Gulp task file
Dissecting issues with our processor
Fixing our Gulp task file
Understanding the changes made
Optimizing the output
Altering our source map support
Taking care of prefixes
Adding support for pseudo-selectors
Updating our code
Dealing with images
Exploring the process
Adding reload capabilities
Extending our processor further
Testing the final pre-processor
Digesting the results of our exercise
Getting started with some hints and tips
Introducing the CSStyle library
Exploring the benefits of using CSStyle
Dissecting our demo
Summary
11. Manipulating Custom Syntaxes
Introducing custom syntaxes
Preparing our environment
Implementing custom syntax plugins
Parsing content and fixing errors
Parsing SCSS content
Exploring what happened
Parsing CSS
Replacing RGBA colors
Exploring how it all works
Formatting the output with the API
Dissecting our example code
Adding source maps
Highlighting our syntax code
Installing themes
Creating a HTML display theme
Summary
12. Mixing Preprocessors
Taking the first steps
Exploring the conversion process
Choosing our plugins
Introducing the Pleeease library
Installing and configuring the Pleeease library
Compiling code manually
Compiling using a task runner
Building an example using Pleeease
Compiling with other preprocessors
Using the PreCSS library
Converting a WordPress installation
Setting up our environment
Considering the conversion process
Making changes to our code
Splitting our style sheet
Adding support for vendor prefixes
Checking our code for consistency
Minifying our code
Creating variables
Adding support for rem units
Nesting rules in our style sheet
Looping through styles
Considering future possible ideas
Compiling and testing the changes
Summary
13. Troubleshooting PostCSS Issues
Fixing some common issues
Exploring some common issues
Not compatible with your operating system…
Task '
Cannot find module '
ReferenceError:
Please provide array of postcss processors!
Entries failing to appear in the package.json file
Output of compiling results is not as expected
Getting help from others
Logging issues at Stack Overflow
Finding a bug with PostCSS
Summary
14. Preparing for the Future
Supporting CSS4 styles today
Converting CSS4 styles for use
Validating e-mail addresses
Supporting the new range input
Supporting future syntax with cssnext
Creating a site template with cssnext
Setting up our demo
Creating plugins to provide extra CSS4 support
Adding future color support to CSS
Going back in time
Creating our own plugin
Summary
Index
- 最珍贵!大英博物馆馆藏珍品([英]马乔里・凯吉尔著,陈早/欧阳遥鹏译)
- 神秘超市(精装)(孙诗洋)
- 水电站电气设备(全国水利行业“十三五”规划教材(普通高等教育))(主编马震岳王刚)
- 保密注意事项简明图册(国务院国资委保密办)
- 杨红樱画本.校园童话系列(新版.全6册):爱玩飞镖的校长先生(杨红樱)
- 5年级全一册-计算题+应用题每日一刻钟-妙趣1+1(支伟力,何铸)
- 海洋水文测量(田淳、周丰年、高宗军、杨鲲编)
- 智慧护理基本技能(夏立平,朱唯一)
