jantimon / next-yak

🦀 Zero-runtime CSS-in-JS powered by Rust. Write styled-components syntax, get build-time CSS extraction and full RSC compatibility
https://yak.js.org
139 stars 4 forks source link

Improve dynamic value error message #212

Closed Mad-Kat closed 2 days ago

Mad-Kat commented 1 week ago

Closes: #208

Error message before:

  x The value for variable "$pageHeaderHeight" could not be found in the top scope
    ,-[input.js:17:1]
 16 |     ` : css`
 17 |       margin-top: ${$pageHeaderHeight}px;
    :                     ^^^^^^^^^^^^^^^^^
 18 |     `};
    `----

Error message afterwards:

  x The shorthand access to the variable "$pageHeaderHeight" is not allowed in a nested expression.
  | To be able to use the property turn it into a CSS variable by wrapping it in a function:
  | 
  | ${() => $pageHeaderHeight};
  | 
    ,-[input.js:17:1]
 16 |     ` : css`
 17 |       margin-top: ${$pageHeaderHeight}px;
    :                     ^^^^^^^^^^^^^^^^^
 18 |     `};
    `----
changeset-bot[bot] commented 1 week ago

🦋 Changeset detected

Latest commit: 8781a8ce3f2edd3fc388a34c0308b90842858789

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages | Name | Type | | -------- | ----- | | yak-swc | Patch | | next-yak | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

codspeed-hq[bot] commented 1 week ago

CodSpeed Performance Report

Merging #212 will not alter performance

Comparing improve-dynamic-value-error-message (8781a8c) with main (94354f3)

Summary

✅ 2 untouched benchmarks