Setting Up TailwindCSS, Shadcn-Vue, and Automatic Component Imports

In this lesson, we'll install and configure Shadcn-Vue and TailwindCSS. We'll then set up automatic imports for all of our local Vue components.

Published
Aug 20, 24
Duration
13m 23s

Developer, dog lover, and burrito eater. Currently teaching AdonisJS, a fully featured NodeJS framework, and running Adocasts where I post new lessons weekly. Professionally, I work with JavaScript, .Net C#, and SQL Server.

Adocasts

Burlington, KY

⏳ Chapters

00:00 - Running Our Project
00:50 - Installing Shadcn-Vue & TailwindCSS
04:00 - Configuring Shadcn-Vue
07:10 - Configuring TailwindCSS
08:35 - Installing Our First Shadcn-Vue Component
09:44 - Testing Our Button Component
10:42 - Automatic Component Registration

Documentation

VSCode Extension

Shadcn-Vue

Join The Discussion! (8 Comments)

Please sign in or sign up for free to join in on the dicussion.

  1. Commented 27 days ago

    Im following along using SolidJS, but got stuck at the auto imports package as it seems to be a vue specific library - how may i get this working with a SolidJS setup? Thanks!

    1

    Please sign in or sign up for free to reply

    1. Commented 14 days ago

      Hi yunus! Apologies for the delayed response! I'm not familiar with the SolidJS ecosystem in the slightest, so I unfortunately do not know. You might have luck using unplugin-auto-import, that is what unplugin-vue-components utilizes, but I'm not certain whether it'll work nor how it'd need to be configured.

      1

      Please sign in or sign up for free to reply

      1. Commented 14 days ago

        Not a problem brother, appreciate the work you're putting into Adonis :). The potential is huge imo and using Inertia fullstack development just makes sense compared to meta frameworks.
        I decided to stick to React until SolidJS matures a bit more. One other thing i would like to suggest while here is; could we get more information about deployment options using Adonis? Cleavr was looking promising, but i would like to do server management myself on AWS for example(EC2 or ECS/Fargate if possible)

        1

        Please sign in or sign up for free to reply

        1. Commented 12 days ago

          Thank you, yunus! I very much agree in regards to using Inertia over meta frameworks when you need the full stack! 😊

          As for deployment, please see my comment here. The TLDR is it's coming, but not something I do myself all that often. So I just need to dedicate some time to do proper R&D to do some lessons justice. 😁

          0

          Please sign in or sign up for free to reply

  2. Commented 18 days ago

    The Vue ecosystem is fantastic. I’ve also set up Prettier with the following plugins:

    • prettier-plugin-tailwindcss

    • prettier-plugin-organize-attributes

    • prettier-plugin-organize-imports

    This setup ensures consistent code formatting while keeping Tailwind classes, attributes, and imports perfectly organized.

    1

    Please sign in or sign up for free to reply

    1. Commented 14 days ago

      Yeah, I absolutely love Vue & it's ecosystem!! Thank you for sharing these plugins' gribbl!! 😊

      0

      Please sign in or sign up for free to reply

  3. Commented 11 days ago

    @tomgobich I followed your instructions to have the unplugin package to autoimport my shadcn-vue components. It works with simple components like buttons, but more complicated ones, such as resizable needs radix-vue, and I had trouble setting it up the vite.config.js to resolve these more complex components. Do you have nay suggestions?

    1

    Please sign in or sign up for free to reply

    1. Commented 10 days ago

      Hi, csaba-kiss!! You can try registering radix-vue's unplugin-vue-components plugin to see if that helps. The caveat here is you'll likely need to use the original name defined in radix-vue, rather than renamed components from shadcn-vue.

      For example, to auto-import, you'd probably need to use the name "SplitterPanel" rather than shadcn-vue's "ResizablePanel."

      I noticed a similar issue when rebuilding the Adocasts CMS and opted to import the components directly instead.

      import Components from 'unplugin-vue-components/vite'
      import RadixVueResolver from 'radix-vue/resolver'
      
      export default defineConfig({
        plugins: [
          vue(),
          Components({
            dts: true,
            resolvers: [
              RadixVueResolver()
      
              // RadixVueResolver({
              //   prefix: '' // use the prefix option to add Prefix to the imported components
              // })
            ],
          }),
        ],
      })
      Copied!
      0

      Please sign in or sign up for free to reply