I have been happily using Vue.js for some time now, and a bit more recently Tailwind CSS. Although there were likely some webpack weirdness to get them working the first time, it was painless enough that I no longer remember the process. However, I recently felt like spinning up something new with the shiny Vue CLI, but was a bit worried on how the integration would work.
After not immediately finding anything in the docs, I went to google, and quickly found this article. Although it got me most of the way there, it left off a few key things I needed to be fully integrated. I'll list all the steps, but essentially it skipped actually installing Tailwind (I assume because that seemed obvious) and didn't set the config to use the tailwind.js file created (which leads me to believe Tailwind has a fall back default, but I didn't verify that).
- vue create my_project
- cd my_project
- yarn add tailwindcss --dev
- ./node_modules/.bin/tailwind init src/tailwind.js
- touch src/assets/main.css
- printf '@tailwind preflight;\n@tailwind components;\n@tailwind utilities;' > src/assets/main.css
1 "postcss": {2 "plugins": {3 "tailwindcss": "./src/tailwind.js",4 "autoprefixer": {}5 }6 },
1 <script>2 import "./assets/main.css";34 export default {};5 </script>
At this point I was able to run yarn server, and observe everything was working by adding a bg-white to an element then changing the color value in the tailwind.js config file.