Every modern site should be using PostCSS!

  Рет қаралды 13,684

Coding in Public

Coding in Public

Күн бұрын

PostCSS is the ultimate CSS tool. It’s completely customizable and incredibly quick. I'll walk you through what it is, how to use it, show you my preferred plugins, and show you how to get it working in a real project.
🔗 Key Links 🔗
- PostCSS website: postcss.org/
- VSCode extension: marketplace.visualstudio.com/...
---------------------------------------
🔗 PostCSS Plugins mentioned 🔗
- www.npmjs.com/package/postcss...
- github.com/postcss/autoprefixer
- cssnano.co/
- github.com/postcss/postcss-mi...
- github.com/postcss/postcss-ne... (for SASS nesting)
- github.com/csstools/postcss-p... (for CSS-spec nesting)
- github.com/postcss/postcss-me...
- github.com/csstools/postcss-p...
- github.com/csstools/postcss-p... (the preset for writing modern CSS)
---------------------------------------
⏲️ Timestamps ⏲️
0:00 Introduction
0:39 What is PostCSS?
0:51 How does PostCSS work?
2:11 Why use PostCSS?
3:28 What PostCSS plugins do I use?
9:17 How do I use PostCSS?
---------------------------------------
🌐 Connect With Me 🌐
- Website: codinginpublic.dev
- Blog: chrispennington.blog
- Twitter: / cpenned
- Patreon: / coding_in_public
- Buy Me a Coffee: www.buymeacoffee.com/chrispen...

Пікірлер: 46
@CodinginPublic
@CodinginPublic Жыл бұрын
I should have mentioned, you don’t HAVE to choose between SCSS and PostCSS; many use them together. I find that using PostCSS covers most of the use cases I have for SCSS, so I don’t often reach for SCSS if I'm using PostCSS. Also …15:57 🤦‍♂
@hoklenghak777
@hoklenghak777 Жыл бұрын
I am your new subscriber! Great contents, man!
@CodinginPublic
@CodinginPublic Жыл бұрын
🙌 glad you enjoyed it!
@dgcp354
@dgcp354 Жыл бұрын
the name of the channel is amazing.
@CodinginPublic
@CodinginPublic Жыл бұрын
Hey, thanks. I definitely view myself more as a learner than a teacher so I wanted to channel to reflect that. I’m learning and coding in public in an attempt to help others as well.
@Web-Dev-Codi
@Web-Dev-Codi Жыл бұрын
Amazing! Thank You.
@CodinginPublic
@CodinginPublic Жыл бұрын
You’re welcome!
@mathieulalonde
@mathieulalonde 13 күн бұрын
Thank you so much! Setting-up PostCSS in Vite really should be better documented... You really helped me 🙂
@CodinginPublic
@CodinginPublic 12 күн бұрын
You’re welcome!
@cranberry888
@cranberry888 Жыл бұрын
your guide is awesome, I was just about to get into this technology. And btw, what theme do you use this time?
@CodinginPublic
@CodinginPublic Жыл бұрын
Great! Glad it was a help! Haha … changed again. I think I'm using TDK Theme (a person who commented made it and mentioned it in my last video!)
@SeanGrimLink
@SeanGrimLink Жыл бұрын
You don't need autoprefixer if your using postcss-preset-env. Personally I do like the scss way of working, combining it with postcss-preset-env and cssnano.
@CodinginPublic
@CodinginPublic Жыл бұрын
Yep! It’s included in preset-env by default! That works! It’s awesome to have so many great tools available!
@Xamy-
@Xamy- Жыл бұрын
For the custom media plugin, what’s its advantage over CSS variables or SASS ones?
@CodinginPublic
@CodinginPublic Жыл бұрын
You can’t use css variables in media queries. So this gives you a similar syntax to do the same thing.
@sulavbaral9972
@sulavbaral9972 Жыл бұрын
Have been using tailwind since the day I've found it got quite comfortable and works good but I think I should give this a spin too
@CodinginPublic
@CodinginPublic Жыл бұрын
Well believe it or not, you’ve already been using it because Tailwind is a PostCSS plugin! The tailwind docs actually encourage you to use the autoprefixer plugin along with tailwind. :)
@moneyfr
@moneyfr Жыл бұрын
Thank you but how would you make prettier & Stylelint works with postcss ?
@CodinginPublic
@CodinginPublic Жыл бұрын
They should work side-by-side. I just wouldn't use any linting plugins in POSTCSS if you’re doing linting another way. Does that help?
@perrosanchez
@perrosanchez Жыл бұрын
Hi, how are you? I've been trying various ways to work with mixins using postCSS, particularly postcss-preset-env, and when I try to call it with @import or @apply it doesn't work in any way. I am in an environment with Astro Build, following your videos! Thank you.
@CodinginPublic
@CodinginPublic Жыл бұрын
Hey! Sorry for the trouble. Hmm…it's really hard to say without seeing your code? If you go to branch 5 (I think) and beyond in the Astro series you should see how I did it? I can't remember if I used either, but I know at least the @import is included in postcss-preset-env. Hope that helps!
@JimKernix
@JimKernix Жыл бұрын
Inside the plugins array I use require("autoprefixer") whereas you use autoprefixer: {}. Is there a difference if which method you use?
@JimKernix
@JimKernix Жыл бұрын
Oh, and I just noticed you use an object for the plugins but I use an array.
@CodinginPublic
@CodinginPublic Жыл бұрын
Yeah, it depends if it’s a common js module basically.
@glorynt7925
@glorynt7925 7 ай бұрын
How to use conditional with postcss mixin?, Example: define-mixin test $value{ @if $value == red { color: red } }
@CodinginPublic
@CodinginPublic 7 ай бұрын
I haven’t used that plugin! Sorry!
@namecanbeblank6311
@namecanbeblank6311 Жыл бұрын
What theme and font are you using?
@CodinginPublic
@CodinginPublic Жыл бұрын
Cascadia Code (free font by Microsoft) and Palenight Operator (I think?) for the theme.
@briankgarland
@briankgarland Жыл бұрын
Is there a way to exclude something from postcss-preset-env or is it all or nothing?
@briankgarland
@briankgarland Жыл бұрын
Got it. Just selectively disable the ones you don't want to use with a false. All are enabled by default depending on the stage level. module.exports = { plugins: [ require('postcss-preset-env')({ stage: 0, features: { 'custom-media-queries': false, } }) ] }
@CodinginPublic
@CodinginPublic Жыл бұрын
Great work. Yep! that's how you select different plugins. Rather than installing preset-env, you can also just individually install a set of plugins you want.
@dein-ding
@dein-ding Жыл бұрын
How can we suppress the @-rule warnings though? It’s extremely annoying, especially if you use something like error lens.
@CodinginPublic
@CodinginPublic Жыл бұрын
There's a setting in VSCode called "Unknown at-rule" that you can change to "Ignore." Hope that helps!
@kushagra-aa
@kushagra-aa Жыл бұрын
Can we get a video about stylelint and postcss plugin
@CodinginPublic
@CodinginPublic Жыл бұрын
I could see myself doing something on stylelint and mentioning the PostCSS plugin as an option?
@kushagra-aa
@kushagra-aa Жыл бұрын
@@CodinginPublic Yess PLease!!
@notnotjake
@notnotjake Жыл бұрын
I still don't really understand why I would want to use this over using scss
@CodinginPublic
@CodinginPublic Жыл бұрын
No worries if you prefer SCSS. PostCSS lets you pick and choose which features you want to add to CSS (or which modern CSS features you want to use), it's not an entire “compiled” system like SCSS (that may not be the right term). But the idea here is both 1) you can piece-meal what you want and 2) you can mostly just write either standard CSS or future standard CSS. Many of the plugins let you write what will eventually be stable in the browsers. But a lot of people feel like you do; it's nice we have so many options!
@edhahaz
@edhahaz 16 күн бұрын
Grabbing 500 plugins at the thrift shop improves things, instead of using sass.
@CodinginPublic
@CodinginPublic 16 күн бұрын
lol what do you miss in modern CSS that scss gives you? Mixins? Loops?
@edhahaz
@edhahaz 15 күн бұрын
​@@CodinginPublic postcss seems to have a bunch of features that overlap sass. It's confusing and I have to pick each feature myself. I only care about polyfills.
@coolemur976
@coolemur976 Ай бұрын
There are downsides of postcss or preprocessors. 1. Yes, it's cool that you can use modern features today that wouldn't be possible with CSS. But... imagine reality... you work on big project with team and stuff, they use PostCSS and everything is great. But then you are assigned to a project that is not using PostCSS and has a lot of legacy code, and the rule of that project is "don't add PostCSS", because someone disagrees to add it. So all your fancy snippets becomes worthless and you feel bad for using old tech when you could be using the modern one. 2. Things like this makes development of pure CSS slower. So many features that could be pushed forward in CSS now are left aside with idea "oh you can just make it with PostCSS so why bother improving CSS specs, it can wait".
@perrosanchez
@perrosanchez Жыл бұрын
Hi, I only use postcss-preset-env with Astro Build, the only thing that doesn't work for me is @custom-media when I call them in an .astro file inside the @media (--lg) {}< tag. /style> how can I solve it, thank you very much for the help!
@CodinginPublic
@CodinginPublic Жыл бұрын
Hmm…this might be something to ask in the Astro discord. I would ASSUME that Astro should pick that up in the bundling of your CSS and run it all through your post css plugin? But I don't know off hand? Sorry!
Sass Crash Course 2022
58:51
Pixel Rocket
Рет қаралды 29 М.
PostCSS Crash Course
34:06
Traversy Media
Рет қаралды 53 М.
ВИРУСНЫЕ ВИДЕО / Мусорка 😂
00:34
Светлый Voice
Рет қаралды 9 МЛН
FOOTBALL WITH PLAY BUTTONS ▶️ #roadto100million
00:24
Celine Dept
Рет қаралды 160 МЛН
GADGETS VS HACKS || Random Useful Tools For your child #hacks #gadgets
00:35
The border property you never knew you needed
14:25
Kevin Powell
Рет қаралды 91 М.
Working with Images in Astro
15:13
Coding in Public
Рет қаралды 3,8 М.
CSS is getting better, but Sass is still relevant
18:42
Kevin Powell
Рет қаралды 28 М.
Build ENTIRE Frontends With ONE Prompt - OpenUI Tutorial
8:59
Matthew Berman
Рет қаралды 49 М.
Learn how to power-up your CSS with PostCSS
20:23
Kevin Powell
Рет қаралды 81 М.
Learn JavaScript With This ONE Project!
1:10:26
Tech With Tim
Рет қаралды 615 М.
PostCSS Crash Course
54:02
Pixel Rocket
Рет қаралды 4,1 М.
Is Sass still relevant?
17:15
Kevin Powell
Рет қаралды 90 М.
7 ways to deal with CSS
6:23
Fireship
Рет қаралды 1 МЛН
بروتين ريفولا معالج للشعر
0:16
Revola Expert Kozmetik
Рет қаралды 3,7 МЛН
Do you use deodorant?😍🥰❤️ #demariki
0:26
Demariki
Рет қаралды 1,3 МЛН
Татуировку ПРИШЛОСЬ удалять ХИРУРГИЧЕСКИ
0:24
Виктор Лодин
Рет қаралды 1,5 МЛН
У кого круче наклейки?
0:49
Li ALINA
Рет қаралды 1,6 МЛН
Fiz uma música com coisas aleatórias?!😱 #shorts #challenge
0:30
Gabrielmiranda_ofc
Рет қаралды 7 МЛН