DEV Community

Cover image for Vite.js + Vue 3 + router + vuex + tailwindcss template
Jorge Arraga
Jorge Arraga

Posted on

5 2

Vite.js + Vue 3 + router + vuex + tailwindcss template

Github CLI usage

If you don't use github CLI to manage yours repositories I recommend that you do it. Install here

gh auth login
Enter fullscreen mode Exit fullscreen mode

Then you can create a repo using this code as a template, the command will create your repo directory.

gh repo create <ownRepoName> --private --template jarraga/vite-vue3-template
Enter fullscreen mode Exit fullscreen mode
? This will create the "<ownRepoName>" repository on Github, Continue? (Y/n) -> YES
Enter fullscreen mode Exit fullscreen mode
? Create a local project directory for "<ownRepoName>"? (Y/n) -> YES
Enter fullscreen mode Exit fullscreen mode

Ok, you have new repository created on Github and local files to start coding.
Let's install dependencies and run dev server.

cd <ownRepoName>
npm i
npm run dev
Enter fullscreen mode Exit fullscreen mode

And that's it, open folder with your code editor and start make changes.

Recomended plugins if you're using visual studio code:

vetur

tailwind

Thing to keep in mind for tailwindcss

If you want to make components using dynamic tailwind classes, you have to literal write the entire classes in an object and acces to it, instead of use something like bg-${color}-300
Simon explain this in detail in this video:

https://youtu.be/HZn2LtBT59w?t=509

I hope you find it useful! 👋🏽

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (3)

Collapse
 
fullzero5 profile image
FullZero • • Edited

Hi, tell me I didn't see how to add an alias @?

resolvers: [
    {
      alias: [
        {
          '@': path.resolve(__dirname, './src'),
        }
      ]
    },
]
Enter fullscreen mode Exit fullscreen mode

does not work

Collapse
 
jarraga profile image
Jorge Arraga •

Hi! your vite.config.js should look like this:

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'

export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      '@': resolve(__dirname, './src')
    }
  }
})
Enter fullscreen mode Exit fullscreen mode

Tell me if it works!

Collapse
 
fullzero5 profile image
FullZero •

Thanks!

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more