@@ -17,20 +17,27 @@ to initialize with the html framework and manually edit the configuration:
17
17
18
18
``` sh
19
19
cd my-app
20
- npx storybook@" ~7 .0.0-beta " init -t html
20
+ npx storybook@" ~8 .0.0" init -t html
21
21
```
22
22
23
- Remove HTML framework/renderer and install PixiJS framework/renderer:
23
+ Remove HTML framework/renderer and install PixiJS framework/renderer based on your bunder :
24
24
25
25
``` sh
26
26
npm remove @storybook/html @storybook/html-webpack5 --save-dev
27
+ ```
28
+
29
+ ```
27
30
npm install @pixi/storybook-renderer @pixi/storybook-webpack5 --save-dev
28
31
```
32
+ _ or_
33
+ ```
34
+ npm install @pixi/storybook-renderer @pixi/storybook-vite --save-dev
35
+ ```
29
36
30
37
Replace ` .storybook/main.js ` with the below, setting up the correct paths as necessary.
31
38
32
39
``` javascript
33
- module . exports = {
40
+ const config = {
34
41
// use glob matching, eg: ../src/stories/**/*.stories.@(ts|tsx|js|jsx|mdx)
35
42
stories: [' RELATIVE_PATH_TO_STORIES' ],
36
43
staticDirs: [' RELATIVE_PATH_TO_ASSETS' ],
@@ -51,35 +58,41 @@ module.exports = {
51
58
buildStoriesJson: true ,
52
59
breakingChangesV7: true ,
53
60
},
54
- framework: ' @pixi/storybook-webpack5' ,
61
+ framework: ' @pixi/storybook-webpack5' , // or '@pixi/storybook-vite'
55
62
};
63
+
64
+ export default config ;
56
65
```
57
66
58
67
Replace ` .storybook/preview.js ` with:
59
68
60
69
``` javascript
61
- export const parameters = {
62
- layout: ' fullscreen' ,
63
- pixi: {
64
- // these are passed as options to `PIXI.Application` when instantiated by the
65
- // renderer
66
- applicationOptions: {
67
- backgroundColor: 0x1099bb ,
68
- resolution: 1 ,
69
- },
70
- // optional, if you want to provide custom resize logic, pass a function here,
71
- // if nothing is provided, the default resize function is used, which looks like
72
- // this, where w and h will be the width and height of the storybook canvas.
73
- resizeFn : (w , h ) => {
74
- return {
75
- rendererWidth: w,
76
- rendererHeight: h,
77
- canvasWidth: w,
78
- canvasHeight: h,
79
- };
70
+ const preview = {
71
+ parameters: {
72
+ layout: ' fullscreen' ,
73
+ pixi: {
74
+ // these are passed as options to `PIXI.Application` when instantiated by the
75
+ // renderer
76
+ applicationOptions: {
77
+ backgroundColor: 0x1099bb ,
78
+ resolution: 1 ,
79
+ },
80
+ // optional, if you want to provide custom resize logic, pass a function here,
81
+ // if nothing is provided, the default resize function is used, which looks like
82
+ // this, where w and h will be the width and height of the storybook canvas.
83
+ resizeFn : (w , h ) => {
84
+ return {
85
+ rendererWidth: w,
86
+ rendererHeight: h,
87
+ canvasWidth: w,
88
+ canvasHeight: h,
89
+ };
90
+ },
80
91
},
81
92
},
82
93
};
94
+
95
+ export default preview ;
83
96
```
84
97
85
98
Depending on where you want to keep your story source, either delete ` src/stories ` folder
0 commit comments