Open8
Nuxt3 + TailwindCSS + Storybook7の設定をする
nuxt3にstorybook7(今はbeta)を入れたい。
以下で入れることができた。
$ npx sb@next init --type vue3
tailwindのグローバルCSSの設定
assets/css/main.css
@tailwind base;
@tailwind components;
@tailwind utilities;
storybookでtailwindcssを読み込むために@storybook/addon-postcss
を追加
$ npm i -D @storybook/addon-postcss
$ yarn add -D @storybook/addon-postcss
storybookの設定
.storybook/main.js
module.exports = {
stories: ["../components/**/stories/*.stories.@([jt]s?(x)|mdx)"],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
{
name: "@storybook/addon-postcss",
options: {
postcssLoaderOptions: {
implementation: require("postcss"),
},
},
},
],
framework: {
name: "@storybook/vue3-webpack5",
options: {},
},
docs: {
autodocs: "tag",
},
}
.storybook/previrew.js
import "../assets/css/main.css"
export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
}