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 got a fully working example of Svelte + TailwindCSS + Storybook in this github repo https://github.com/jerriclynsjohn/svelte-storybook-tailwind
But Integrating should be very much similar:
webpack.config.js
in your .storybook
folder and add the following:const path = require('path');
module.exports = ({ config, mode }) => {
config.module.rules.push({
test: /\.css$/,
loaders: [
{
loader: 'postcss-loader',
options: {
sourceMap: true,
config: {
path: './.storybook/',
},
},
},
],
include: path.resolve(__dirname, '../storybook/'),
});
return config;
};
postcss.config.js
in your .storybook
folder with the following:var tailwindcss = require('tailwindcss');
module.exports = {
plugins: [
require('postcss-import')(),
tailwindcss('./tailwind.config.js'), //This refers to your tailwind config
require('autoprefixer'),
],
};
utils.css
file in your storybook folder@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';
<>.stories.js
:import '../../css/utils.css';
I really recommend you refer to the implementation in the github repo, it also has things that are specific to Storybook. (Github)