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

feat: implement css template literal for server components #137

Merged
merged 1 commit into from
Mar 27, 2024

Conversation

aralroca
Copy link
Collaborator

Fixes #136

css

css(strings: TemplateStringsArray, ...values: string[]): void

The css template literal is used to inject CSS into the DOM. It allows developers to define styles directly within server components using a template literal.

Unlike web components, this css template literal in server components does not encapsulate. This code would affect all divs on the page:

Example:

css`
  div {
    background-color: ${color};
  }
`;

Tip

We recommend using the css template literal for specific cases such as generating CSS animations based on dynamic JavaScript variables.

For more details, refer to the Template literal css documentation.

@aralroca aralroca requested review from amatiasq and danielart March 27, 2024 22:17
@aralroca aralroca self-assigned this Mar 27, 2024
@aralroca aralroca merged commit 955689e into main Mar 27, 2024
1 check failed
@aralroca aralroca deleted the css-server branch March 27, 2024 22:18
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.

Support css template literal for server components
1 participant