Skip to content

Instantly share code, notes, and snippets.

@RoboWeb
Last active September 9, 2022 17:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RoboWeb/51b125402249882de49d76d322dc2b2d to your computer and use it in GitHub Desktop.
Save RoboWeb/51b125402249882de49d76d322dc2b2d to your computer and use it in GitHub Desktop.

1. Install Vue.js

npm init vue@latest

then:

✔ Project name: … <your-project-name>
✔ Add TypeScript? … No / Yes
✔ Add JSX Support? … No / Yes
✔ Add Vue Router for Single Page Application development? … No / Yes
✔ Add Pinia for state management? … No / Yes
✔ Add Vitest for Unit testing? … No / Yes
✔ Add Cypress for both Unit and End-to-End testing? … No / Yes
✔ Add ESLint for code quality? … No / Yes
✔ Add Prettier for code formatting? … No / Yes

Scaffolding project in ./<your-project-name>...
Done.

2. Install TalwindCSS

  1. Install
npm install -D tailwindcss@latest postcss@latest autoprefixer@latest
  1. Create configuration files
npx tailwindcss init -p
  1. Configuration
// tailwind.config.js
module.exports = {
  content: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'],
  darkmode: 'media', // 'media' or 'class' - 'media' is default, so you don't need to set it up here
  theme: {
    extend: {}
  }
  ...
}
  1. include Tailwind in CSS
/* e.g. ./src/assets/main.css */
@import - if neeeded - always firs

@tailwind base;
@tailwind components;
@tailwind utilities;

/// other css styles
  1. Make sure your style is imported
// src/main.js/ts
import { createApp } from 'vue';
import { createPinia } from 'pinia';

import App from './App.vue';
import router from './router';

import './assets/main.css';

const app = createApp(App);
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment