Designing with Tailwind CSS: Composing Utilities with @apply

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

КОМЕНТАРІ • 27

  • @Gui-sr2jw
    @Gui-sr2jw 3 роки тому +25

    Tailwind v2 now supports variants (responsive, hover, focus, active) on the @apply rule. You can define it all at once instead of creating styles for each variant. Great feature!

  • @ashutoshanand4263
    @ashutoshanand4263 3 роки тому +3

    Instead of using @apply directive in tailwind.css file , I want to use it in any .scss file.
    For example, in react whenever I create a component, I create a folder and an inside it I create a index.tsx file and a .scss file. I want to use @apply directive in that .scss file. How can I achieve that ??

  • @briansluther
    @briansluther 3 роки тому

    Wow, I was epicing trying to figure out why I couldn't "cascade" additional styles on top of my own class.. turns out I needed to have my classes above @utilities! What a relief, thank you! Great video, very clear and helpful, looking forward to checking out more.
    Side question, I have my css named index.css, should it be tailwind.css for any reason?
    Thanks!

  • @digigoliath
    @digigoliath 4 роки тому +1

    Nice! TQVM!!

  • @davidrocky
    @davidrocky 3 роки тому +1

    not working for me, "active" yet being ignored.

    • @Gui-sr2jw
      @Gui-sr2jw 3 роки тому

      Confirm that the order of the personalized variants declaration is the following: responsive, hover, focus, active. You likely set 'active' before some other one.

  • @tahseenalaa7030
    @tahseenalaa7030 3 роки тому +1

    It like building Bootstrap using TailwindCSS, Thanks for this awesome framework

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

      library

    • @ohmegatech666
      @ohmegatech666 5 місяців тому

      I can't tell if you're being sarcastic. Bootstrap is a totally separate library which is more opinionated and less customizable. Tailwind is not a framework but a library that can be used in frameworks like Next or Angular, or just in an otherwise vanilla JS project

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

    vary useful!

  • @sinaukode
    @sinaukode 4 роки тому

    My vscode marked @apply as an error, how to solve it???

    • @joeholmes4711
      @joeholmes4711 3 роки тому

      this helped me stackoverflow.com/questions/47607602/how-to-add-a-tailwind-css-rule-to-css-checker

  • @kwangee
    @kwangee 4 роки тому

    4:55 I using Nuxt.js with Tailwind, if i put the .btn css block between @import 'tailwindcss/components'; @import 'tailwindcss/utilities'; , i will get "@import must precede all other statements (besides @charset)" from postcss-loader. Any idea how to solve this?

    • @AdamWathan
      @AdamWathan  4 роки тому +3

      Put your btn in a separate file and import it or switch to the "@tailwind components" syntax instead of the import syntax 👍

    • @kwangee
      @kwangee 4 роки тому

      @@AdamWathan thanks

    • @ohmegatech666
      @ohmegatech666 5 місяців тому

      Modern Next js supports putting tailwind into globals.css like this:
      @tailwind base;
      @tailwind components;
      @tailwind utilities;

  • @davidliendo9677
    @davidliendo9677 4 роки тому

    How did he change the name of multiple classes at once?

    • @YONS_
      @YONS_ 4 роки тому

      ctrl+d or cmd+d

    • @davidliendo9677
      @davidliendo9677 4 роки тому

      @@YONS_ thank you!

    • @YONS_
      @YONS_ 4 роки тому

      @@davidliendo9677 You're welcome, also ctrl+shift+L which will select every occurrence of a selection , vscode has a lot of shortcuts that will make your life easier

    • @davidliendo9677
      @davidliendo9677 4 роки тому +1

      @@YONS_ Yes, thanks for the advice! I also use Prietter an extension for VS code which makes typing in JS really easy

  • @arcticape445
    @arcticape445 4 роки тому +2

    What code editor is this and how do you get the website preview on the right? Thanks

    • @deniskovalev2699
      @deniskovalev2699 4 роки тому

      Editor: VSCode, Browser: Sizzy (need to pay for use)

    • @porte0
      @porte0 3 роки тому +3

      Responsively App is a free alternative.

    • @Gui-sr2jw
      @Gui-sr2jw 3 роки тому +2

      @@porte0 Thank you! I was looking for a good alternative, and just found it

  • @birdbrainsolutions6112
    @birdbrainsolutions6112 4 роки тому

    7:02 LMAO!