Skip to content

feat: standalone visual context CSS generation#180

Open
amanabiy wants to merge 1 commit into
mainfrom
dev-v3-amanabiy
Open

feat: standalone visual context CSS generation#180
amanabiy wants to merge 1 commit into
mainfrom
dev-v3-amanabiy

Conversation

@amanabiy
Copy link
Copy Markdown
Member

@amanabiy amanabiy commented May 28, 2026

Issue #, if available:

This change allows new visual contexts to be compiled to separate CSS files that are only included in the bundle when the component is imported, making context addition scalable without growing the base bundle.

Description of changes:

Adds a destination field to the Context interface. When set, the context is excluded from the base styles and compiled to its own CSS file at the specified path. The component that uses the context imports this file directly.

// In the context definition:
{
  id: 'navigation-bar',
  selector: '.awsui-context-navigation-bar',
  destination: 'visual-contexts/navigation-bar.scoped.css',
  defaultMode: 'dark',
  tokens: { ... }
}

// In the component:
import '../visual-contexts/navigation-bar.scoped.css';

Tested with

  • components PR #4477 (last commit) consuming directly from this branch
  • Generated file verified: correct token overrides, :not(#\9) specificity, excluded from base styles, existing contexts unchanged

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@amanabiy amanabiy requested a review from pan-kot May 28, 2026 12:27
@amanabiy amanabiy force-pushed the dev-v3-amanabiy branch 3 times, most recently from b4562d5 to 5c4b285 Compare May 28, 2026 15:29
@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

❌ Patch coverage is 97.24771% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.63%. Comparing base (beaa124) to head (fd212d8).

Files with missing lines Patch % Lines
src/build/tasks/standalone-contexts.ts 89.65% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #180      +/-   ##
==========================================
+ Coverage   97.58%   97.63%   +0.05%     
==========================================
  Files          48       49       +1     
  Lines        2651     2751     +100     
  Branches      545      530      -15     
==========================================
+ Hits         2587     2686      +99     
- Misses         64       65       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@amanabiy amanabiy marked this pull request as ready for review May 28, 2026 15:38
@amanabiy amanabiy requested a review from a team as a code owner May 28, 2026 15:38
@amanabiy amanabiy removed the request for review from a team May 28, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant