How to use Storybook in Laravel-Vue.js app

Viewed 1564

My issue is how to use Storybook Components in Laravel-Vue application. I've tried to extract Storybook to static app and import it in second application but it dosen't work. I used

https://storybook.js.org/basics/exporting-storybook/

and

https://storybook.js.org/basics/exporting-storybook/

I'd like to automatically import all storybook, not manually a few components. I would be grateful for any help. :)

problem solved!

Firstly: in file index.js in storybook's files you must export components

import MyComponent from './src/components/MyComponent.vue';

export default {
    MyComponent
}

Secondly: push all project to e.g. git or as npm package.

Thirdly: Import storybook to another project in package.json in

dependencies
"dependencies": {
    "storybook": "git+http://path-to-project-with-storybook"
}

next run npm update

Fourthly: import components from storybook in js file in your project

import storybook from 'storybook'
export default {
    name: 'app',
    components: {
        MyComponent : storybook.MyComponent,
    }
}
1 Answers
npx -p @storybook/cli sb init --type vue

You can simply type this command and it will generate a simple vue js boilerplate version for you

Related