-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nx 13 storybook does not pull in assets or global styles #8681
Comments
Hi there @jasedwards! Thanks for filing an issue! Please take a look at this. Since the latest version of Storybook/Angular there were some issues with the defaultProject. For that reason, we encourage people to use the |
@mandarini
If the components in mylib and mylib2 depend on global styles I need to apparently use a projectConfig from myapp. myapp config would either need to pull in stories from mylib and mylib2 or I need a 2nd app for mylib2. Is this correct? Before the upgrade, I could use config for each lib but it would build my default app, which pulled in the assets and global scss. My repo has over 200 libs so if this is the case then storybook has become unusable for me unless I want to run stories for all libs everytime just to test out one component. |
Hi @jasedwards ! Let's take this step by step, and don't worry, we'll figure it out! I am sure that Storybook is not unusable for you, since I am sure the Storybook team is taking into account cases like yours! :) You definitely do NOT need an app for every library you use Storybook for! :) What happens if you use the
and
? |
@mandarini Ok, I should have just tested that out before responding. I assumed setting the project build config to the app would use that tsconfig and main.js and end up pulling in all stories for the entire repo but it did not. So to fix this I just need to set my build configs to use the app build config for each. Thanks for your help |
@jasedwards Yep, that's what you need to do! You can do this on your libraries' Storybook uses the |
Hi, The components in the library are using bootstrap styles. I tried the following approaches and still bootstrap styles are not applied in the storybook: Approach 1: Approach 2: |
@rmeshksar What I ended up doing was creating an app called storybook-wrapper. in this I have my styles.scss that imports any global styles. then I use that project config to storybook libraries. The added benefit of this is that I can also run storybook on storbook-wrapper and with a tweak of main.js I am able to have one site showing stories for all components in all libs. |
Thanks @jasedwards . |
@rmeshksar You mentioned trying to import the scss from project.json or preview.js. The advantage of having an app dedicated to running storybook config is that you can just import that stuff like any other app |
Currently I have bootstrap in the list of styles in the myApp project.json file. |
I am unfamiliar with how the project.json relates to adding styles. I always just import what I need in the styles.scss file |
Hi all, I'll make sure to add some clearer documentation on that some time soon! :) |
New docs for |
just add this to your library .storybook/preview.js file and your good to go
|
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Current Behavior
When I run storybook against a library no global styles or assets are included.
Expected Behavior
In previous versions when running storybook it would run it against your default app. My default app would have a styles.scss that imported a global sass styles as well as an assets folder. Now it appears no apps are used/needed so nothing gets pulled in
Steps to Reproduce
just generate a workspace, app and lib. use global styles and see that they are not applied.
Environment
Node : 14.17.0
OS : win32 x64
npm : 6.14.13
nx : undefined
@nrwl/angular : 13.4.6
@nrwl/cli : 13.4.6
@nrwl/cypress : 13.4.6
@nrwl/devkit : 13.4.6
@nrwl/eslint-plugin-nx : 13.4.6
@nrwl/express : undefined
@nrwl/jest : 13.4.6
@nrwl/linter : 13.4.6
@nrwl/nest : undefined
@nrwl/next : undefined
@nrwl/node : undefined
@nrwl/nx-cloud : undefined
@nrwl/react : undefined
@nrwl/react-native : undefined
@nrwl/schematics : undefined
@nrwl/tao : 13.4.6
@nrwl/web : undefined
@nrwl/workspace : 13.4.6
@nrwl/storybook : 13.4.6
@nrwl/gatsby : undefined
typescript : 4.5.4
rxjs : 7.4.0
Community plugins:
@angular/animations: 13.1.2
@angular/cdk: 13.1.2
@angular/common: 13.1.2
@angular/compiler: 13.1.2
@angular/core: 13.1.2
@angular/forms: 13.1.2
@angular/localize: 13.1.2
@angular/material: 13.1.2
@angular/platform-browser: 13.1.2
@angular/platform-browser-dynamic: 13.1.2
@angular/router: 13.1.2
@ng-bootstrap/ng-bootstrap: 11.0.0
@ngrx/component-store: 13.0.2
@ngrx/effects: 13.0.2
@ngrx/entity: 13.0.2
@ngrx/router-store: 13.0.2
@ngrx/store: 13.0.2
@angular-devkit/build-angular: 13.1.3
@angular/cli: 13.1.3
@angular/compiler-cli: 13.1.2
@angular/language-service: 13.1.2
@ngrx/schematics: 13.0.2
@ngrx/store-devtools: 13.0.2
@schematics/clearsight: 0.0.1
@storybook/angular: 6.4.13
eslint-plugin-ngrx: 1.46.3
The text was updated successfully, but these errors were encountered: