Skip to content
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

Angular: Fix filtering of workspace config styles #27108

Merged

Conversation

valentinpalkovic
Copy link
Contributor

@valentinpalkovic valentinpalkovic commented May 13, 2024

Relates #24768

What I did

Currently, every kind of style is injected into the iframe HTML, although some of them are marked with inject:false to not inject them, but rather to leave it to the user to dynamically load them if required.

So, let's say a user defines two different styles via workspace configuration:

{
  ...
  "projects": {
    "angular-latest": {
     ...
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:application",
          "options": {
            ...
            "styles": [
              "src/styles.scss",
              {
                "input": "src/design.tokens.css",
                "inject": false,
                "bundleName": "design-tokens"
              }
            ],

Then styles.scss should be injected into the iframe.html, whereas the design-tokens one shouldn't be.

Huge shoutout to @andriy-statsenko-lightit to figuring out this bug and has helped with the solution!

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

  1. Run an Angular sandbox in no-link mode`
  2. Adjust the workspace configuration in angular.json to use two different styles, where one is injected (string or object notation with inject=true) and the other one is not injected (inject=false)
  3. Make sure, that only injected styles are put into the iframe.html

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This pull request has been released as version 0.0.0-pr-27108-sha-2470133a. Try it out in a new sandbox by running npx storybook@0.0.0-pr-27108-sha-2470133a sandbox or in an existing project with npx storybook@0.0.0-pr-27108-sha-2470133a upgrade.

More information
Published version 0.0.0-pr-27108-sha-2470133a
Triggered by @valentinpalkovic
Repository storybookjs/storybook
Branch valentin/fix-angular-styles-options-filtering
Commit 2470133a
Datetime Wed May 15 11:50:01 UTC 2024 (1715773801)
Workflow run 9095112714

To request a new release of this pull request, mention the @storybookjs/core team.

core team members can create a new canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=27108

Copy link

nx-cloud bot commented May 13, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit cca91fc. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 2 targets

Sent with 💌 from NxCloud.

@valentinpalkovic valentinpalkovic force-pushed the valentin/fix-angular-styles-options-filtering branch 2 times, most recently from 15555c7 to 2470133 Compare May 15, 2024 11:49
Currently, every kind of style is injected into the iframe HTML, although some of them are marked with inject:false to not inject them, but rather to leave it to the user to dynamically load them if required
@valentinpalkovic valentinpalkovic force-pushed the valentin/fix-angular-styles-options-filtering branch from 2470133 to cca91fc Compare May 15, 2024 11:50
@valentinpalkovic valentinpalkovic marked this pull request as ready for review May 15, 2024 12:10
Copy link
Member

@yannbf yannbf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Did not test but seems like a community member with a real use case has extensively tested which is amazing!

@valentinpalkovic valentinpalkovic added ci:merged Run the CI jobs that normally run when merged. patch:yes Bugfix & documentation PR that need to be picked to main branch and removed ci:normal labels May 17, 2024
@valentinpalkovic valentinpalkovic merged commit a2bbf3e into next May 17, 2024
88 checks passed
@valentinpalkovic valentinpalkovic deleted the valentin/fix-angular-styles-options-filtering branch May 17, 2024 14:05
storybook-bot pushed a commit that referenced this pull request May 17, 2024
…s-options-filtering

Angular: Fix filtering of workspace config styles
(cherry picked from commit a2bbf3e)
storybook-bot pushed a commit that referenced this pull request May 17, 2024
…s-options-filtering

Angular: Fix filtering of workspace config styles
(cherry picked from commit a2bbf3e)
storybook-bot pushed a commit that referenced this pull request May 17, 2024
…s-options-filtering

Angular: Fix filtering of workspace config styles
(cherry picked from commit a2bbf3e)
storybook-bot pushed a commit that referenced this pull request May 20, 2024
…s-options-filtering

Angular: Fix filtering of workspace config styles
(cherry picked from commit a2bbf3e)
storybook-bot pushed a commit that referenced this pull request May 21, 2024
…s-options-filtering

Angular: Fix filtering of workspace config styles
(cherry picked from commit a2bbf3e)
storybook-bot pushed a commit that referenced this pull request May 21, 2024
…s-options-filtering

Angular: Fix filtering of workspace config styles
(cherry picked from commit a2bbf3e)
storybook-bot pushed a commit that referenced this pull request May 21, 2024
…s-options-filtering

Angular: Fix filtering of workspace config styles
(cherry picked from commit a2bbf3e)
@github-actions github-actions bot added the patch:done Patch/release PRs already cherry-picked to main/release branch label May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
angular bug ci:merged Run the CI jobs that normally run when merged. patch:done Patch/release PRs already cherry-picked to main/release branch patch:yes Bugfix & documentation PR that need to be picked to main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants