9
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Storybook (Vue) で Vuetifyを使う

Last updated at Posted at 2019-01-16

wrote: 2019.1.16

install vuetify

vue add vuetify

install storybook

npx -p @storybook/cli sb init

config

.storybook/config.jsに以下を追加

import Vue from "vue";
import Vuetify from "vuetify";
import "vuetify/dist/vuetify.css";

Vue.use(Vuetify, {
  iconfont: "md"
});

addDecorator(() => ({
  template: "<v-app><story/></v-app>"
}));

configは以下のようになる。

.storybook/config.js
import { configure, addDecorator } from "@storybook/vue";
import Vue from "vue";
import Vuetify from "vuetify";
import "vuetify/dist/vuetify.css";

Vue.use(Vuetify, {
  iconfont: "md"
});

addDecorator(() => ({
  template: "<v-app><story/></v-app>"
}));

// automatically import all files ending in *.stories.js
const req = require.context("../stories", true, /.stories.js$/);
function loadStories() {
  req.keys().forEach(filename => req(filename));
}

configure(loadStories, module);

yarn add stylus
yarn add stylus-loader

preview-head.html
  <link href='https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900|Material+Icons' rel="stylesheet">

#参考

Vue + Vuetify theme not working · Issue #4256 · storybooks/storybook

Quick Start — Vuetify.js

9
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?