Anyone have success setting up a project using VueJS, PostCss, and Tailwind with component development in Storybook?
I\'ve gotten this far:
vue>
I've never used tailwindCSS or postCSS (explicitly) before, so I decided to take this as an opportunity to learn to setup/configure both of these.
You can find a complete example with Tailwind-styled components in storybook here: https://github.com/gurupras/vuejs-postcss-tailwind-with-storybook
vue create vue-postcss-tailwind-storybook
npm install tailwindcss
./node_modules/.bin/tailwind init
(generates tailwind.config.js
)module.exports = {
plugins: [
require('tailwindcss')('tailwind.config.js'),
require('autoprefixer')()
]
}
vue add storybook
src/style/tailwind.css
)@tailwind base;
@tailwind components;
@tailwind utilities;
import '@/style/tailwind.css'
to your main.js
to ensure that they're available to all parts of your appsrc/components/alert.vue
/* eslint-disable import/no-extraneous-dependencies */
import { storiesOf } from '@storybook/vue'
// You need to import this once
import '@/style/tailwind.css'
import Alert from '@/components/alert.vue'
storiesOf('Alert', module)
.add('with text', () => ({
components: { Alert },
template: ' '
}))
npm run storybook:serve
Hope this helps with your setup. Meanwhile, I'm going to read up and see how TailwindCSS can help me create better components!