-
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
No global style in Storybook with Angular 12 #7054
Comments
I am experiencing the exact same issue. |
Same for me. |
Same here. |
We downgraded |
I am also having the same issue. I got around for now by creating a wrapper component decorator for my stories which is having the needed scss files in the styleUrls array property. |
I think this will be fixed in storybook 6.4 🤞 |
After some hours this work for me. Using webpack 5 with Lib Angular 12 and storybook 6.4-beta.1 |
I have also tried using storybook 6.4-beta.1. It required having a property buildStoriesJson: true set in your main.ts which generates a stories.json file when doing a build of your storybook project. My build is working but when I run the storybook i am getting a message my storybook is empty. Inspecting the generated stories.json file in my dist is giving me the following => {"v":3,"stories":{}} |
Hi all! Thanks for filing this issue. From the comments I understand that this can be solved (and will be solved) on the Storybook side, hence the label I just added (third-party). However, please also try this with the latest version of Nx, since we now use webpack5, which I see plays some part in this. |
@mandarini @hjalmers Is there a fix coming? From the PR it seems they simply downgraded @angular-devkit/build-angular to version 12.1.4. If so, it's not a viable solution: https://github.com/sebgroup/green/pull/228/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519L60 Also, it seems Angular team has refused to fix it in @angular-devkit/build-angular @alan-agius4 angular/angular-cli#21747 |
i removed import '!style-loader!css-loader!sass-loader!./styles.scss' and add './styles.scss' to angular.json new project 'only-needed-for-style-injection':
and apply patch to styles loader for fixing source map https://stackoverflow.com/a/69754973/6372326 |
Closing this as it is a Storybook related issue that should have been addressed in this Storybook PR: storybookjs/storybook#15744 The latest Nx version already upgrades you to the |
Hi @juristr is seems like storybook added a global style option to |
Hi there @itayod! Can you please take a look at this comment here, and that issue in general, and let me know if it works for you? Linking the styles under the |
Hi @mandarini thanks for your comment :) it seems to be working fine after adding the styles to |
Hi @itayod ! Thank you for your recommendation and I'm very happy it works for you. What would your suggestion be, regarding updating our |
you should update the it isn't the best docs but it might give other developers a hint about this property :) |
Ah I see! I will look into this, thank you! |
That didn't work entirely but did point me in the right direction to configure styles in two places:
(it's a pity that an import in preview.js never worked; angular.json is the wrong place for this imho) |
Hey you all! I spend an eternity trying to fix this issue. In my case, the problem was that the targets ( I generated it via the
I had to manually update the Now my complete configuration looks like this:
Everything works as expected now. Using Update: For more context, not sure if it's relevant or not, but the library I was adding storybook configuration into, is buildable - it already had the |
Ahhhh thank you @junekpavel ! I think we need to update the documentation to make it clearer. Here is the current status on the documentation for this issue you were having. |
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
The global style is not applied in Storybook.
It has been added in
preview.js
as follows:Expected Behavior
The global style gets applied to each Storybook story.
Steps to Reproduce
yarn install
yarn start:storybook
d-flex
(utility class from Bootstrap) is not appliedEnvironment
The text was updated successfully, but these errors were encountered: