DEV Community

Roby Cigar
Roby Cigar

Posted on • Edited on

2 2

Instalasi Vue 3 dengan TailwindCSS

Jika belum install vue-cli saya sarankan diinstall terlebih dahulu menggunakan command.

yarn global add @vue/cli
# atau
npm install -g @vue/cli
Enter fullscreen mode Exit fullscreen mode

setelah itu kita mulai install boilerplate(semacam template) vue

vue create example-vue
Enter fullscreen mode Exit fullscreen mode

Nanti akan ada beberapa opsi, kalian tinggal baca2 saja lalu pencet enter. (kalau kalian bingung gatau mau milih apaan, tinggal pilih pilihan yang tulisannya default ajah)

setelah itu install tailwind

npm install -D tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9
Enter fullscreen mode Exit fullscreen mode

Jalankan command berikut maka akan muncul file bernama tailwind.config.js dan postcss.config.css

npx tailwindcss init -p
Enter fullscreen mode Exit fullscreen mode

Buka file tailwind.config.js dan ganti degan

  module.exports = {
    purge: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'],
    darkMode: false, // or 'media' or 'class'
    theme: {
      extend: {},
    },
    variants: {
      extend: {},
    },
    plugins: [],
  }
Enter fullscreen mode Exit fullscreen mode

Setelah itu buat file bernama index.css di folder src dan tambahkan 3 line berikut ke file css tersebut

@tailwind base;
@tailwind components;
@tailwind utilities;
Enter fullscreen mode Exit fullscreen mode

Kaitkan file index.css dengan main.js

// src/main.js
import { createApp } from 'vue'
import App from './App.vue'
import './index.css'

createApp(App).mount('#app')
Enter fullscreen mode Exit fullscreen mode

Sumber:
https://tailwindcss.com/docs/installation#installing-tailwind-css-as-a-post-css-plugin

SurveyJS custom survey software

Build Your Own Forms without Manual Coding

SurveyJS UI libraries let you build a JSON-based form management system that integrates with any backend, giving you full control over your data with no user limits. Includes support for custom question types, skip logic, an integrated CSS editor, PDF export, real-time analytics, and more.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay