Fireship · @fireship
PostCSS in 100 Seconds
Uploaded September 2, 2021 · Length 2:13
Summary
postcss explained as a tool for transforming styles with javascript plugins for website development.
- postcss
- css transformation
- javascript plugins
- website development
- css build tool
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
post css a tool for transforming styles
- 0:03
with javascript plugins when you build a
- 0:05
website the css code you write is rarely
- 0:08
the code that you actually want to ship
- 0:09
to the browser the developer wants to
- 0:11
write code with modern features that
- 0:13
maximize productivity but end users want
- 0:15
fast minified code that supports legacy
- 0:18
browsers post css is a build tool that
- 0:20
makes everybody happy it can take a css
- 0:22
file and convert it to an abstract
- 0:24
syntax tree then provides an api where
- 0:27
plugins written in javascript can
- 0:29
produce a different output for example
- 0:31
by using the auto prefixer plugin you'll
- 0:33
never have to worry about writing vendor
- 0:34
prefixes on your styles ever again or
- 0:37
with the preset enb plugin you can write
- 0:39
modern css while post css will
- 0:41
automatically add the polyfills needed
- 0:43
to support your targeted browsers or you
- 0:46
might drop in a tool like style and to
- 0:48
detect issues before they break your ui
- 0:50
and there are tons of other useful
- 0:51
plugins in the ecosystem to try out and
- 0:53
if none of them meet your needs you can
- 0:55
always build your own you might use the
- 0:56
plugin api to find all the color
- 0:58
declarations in the code then write some
- 1:00
javascript to transform them to a
- 1:02
different format you probably already
- 1:03
use post css without even realizing it
- 1:06
as it generates more npm downloads than
- 1:08
typescript and webpack can bind it's
- 1:10
used under the hood by frameworks like
- 1:12
veed and next js to provide a
- 1:14
streamlined developer experience and
- 1:16
it's also used by some of the world's
- 1:17
most popular websites like wikipedia and
- 1:19
twitter now despite its name it also
- 1:22
handles pre-processing similar to
- 1:24
frameworks like sas less and stylus it
- 1:26
can be used in conjunction with existing
- 1:28
preprocessors or as an alternative to
- 1:30
them altogether if you want to write css
- 1:33
with nesting or mixins there are plugins
- 1:35
that can enable those features in your
- 1:37
code so it's like configuring your own
- 1:39
css preprocessor by including your
- 1:41
favorite features and avoiding the ones
- 1:43
that tend to lead to bad practices on
- 1:45
top of that it tends to produce much
- 1:47
faster build times to get started
- 1:49
install it into your project with npm
- 1:51
then create a post css config file
- 1:54
inside of it customize the array of
- 1:55
plugins that you want to use and finally
- 1:57
run it from the command line as part of
- 1:59
your build process to make your styles


