Every modern site should be using PostCSS!

Поділитися
Вставка
  • Опубліковано 29 січ 2025

КОМЕНТАРІ • 45

  • @CodinginPublic
    @CodinginPublic  2 роки тому +5

    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 🤦‍♂

  • @dgcp354
    @dgcp354 2 роки тому +1

    the name of the channel is amazing.

    • @CodinginPublic
      @CodinginPublic  2 роки тому +3

      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.

  • @mathieulalonde
    @mathieulalonde 9 місяців тому

    Thank you so much! Setting-up PostCSS in Vite really should be better documented... You really helped me 🙂

  • @hoklenghak777
    @hoklenghak777 2 роки тому

    I am your new subscriber! Great contents, man!

  • @JimKernix
    @JimKernix 2 роки тому

    Inside the plugins array I use require("autoprefixer") whereas you use autoprefixer: {}. Is there a difference if which method you use?

    • @JimKernix
      @JimKernix 2 роки тому

      Oh, and I just noticed you use an object for the plugins but I use an array.

    • @CodinginPublic
      @CodinginPublic  2 роки тому +1

      Yeah, it depends if it’s a common js module basically.

  • @Web-Dev-Codi
    @Web-Dev-Codi Рік тому

    Amazing! Thank You.

  • @briankgarland
    @briankgarland 2 роки тому

    Is there a way to exclude something from postcss-preset-env or is it all or nothing?

    • @briankgarland
      @briankgarland 2 роки тому

      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  2 роки тому

      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.

  • @moneyfr
    @moneyfr 2 роки тому

    Thank you but how would you make prettier & Stylelint works with postcss ?

    • @CodinginPublic
      @CodinginPublic  2 роки тому

      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 2 роки тому

    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  2 роки тому

      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!

  • @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!

  • @namecanbeblank6311
    @namecanbeblank6311 2 роки тому

    What theme and font are you using?

    • @CodinginPublic
      @CodinginPublic  2 роки тому +1

      Cascadia Code (free font by Microsoft) and Palenight Operator (I think?) for the theme.

  • @Xamy-
    @Xamy- 2 роки тому

    For the custom media plugin, what’s its advantage over CSS variables or SASS ones?

    • @CodinginPublic
      @CodinginPublic  2 роки тому +1

      You can’t use css variables in media queries. So this gives you a similar syntax to do the same thing.

  • @dein-ding
    @dein-ding 2 роки тому

    How can we suppress the @-rule warnings though? It’s extremely annoying, especially if you use something like error lens.

    • @CodinginPublic
      @CodinginPublic  2 роки тому +1

      There's a setting in VSCode called "Unknown at-rule" that you can change to "Ignore." Hope that helps!

  • @cranberry888
    @cranberry888 2 роки тому +1

    your guide is awesome, I was just about to get into this technology. And btw, what theme do you use this time?

    • @CodinginPublic
      @CodinginPublic  2 роки тому

      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 2 роки тому +1

    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  2 роки тому +1

      Yep! It’s included in preset-env by default! That works! It’s awesome to have so many great tools available!

  • @glorynt7925
    @glorynt7925 Рік тому

    How to use conditional with postcss mixin?,
    Example:
    define-mixin test $value{
    @if $value == red {
    color: red
    }
    }

  • @kushagra-aa
    @kushagra-aa 2 роки тому

    Can we get a video about stylelint and postcss plugin

    • @CodinginPublic
      @CodinginPublic  2 роки тому +1

      I could see myself doing something on stylelint and mentioning the PostCSS plugin as an option?

    • @kushagra-aa
      @kushagra-aa 2 роки тому

      @@CodinginPublic Yess PLease!!

  • @notnotjake
    @notnotjake 2 роки тому

    I still don't really understand why I would want to use this over using scss

    • @CodinginPublic
      @CodinginPublic  2 роки тому

      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!

  • @sulavbaral9972
    @sulavbaral9972 2 роки тому

    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  2 роки тому +3

      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. :)

  • @edhahaz
    @edhahaz 9 місяців тому

    Grabbing 500 plugins at the thrift shop improves things, instead of using sass.

    • @CodinginPublic
      @CodinginPublic  9 місяців тому

      lol what do you miss in modern CSS that scss gives you? Mixins? Loops?

    • @edhahaz
      @edhahaz 9 місяців тому

      ​@@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 10 місяців тому

    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".