summaryrefslogtreecommitdiff
path: root/docs/src
diff options
context:
space:
mode:
authorGravatar Ian VanSchooten <ian.vanschooten@gmail.com> 2021-11-19 17:57:53 -0500
committerGravatar GitHub <noreply@github.com> 2021-11-19 14:57:53 -0800
commit8d7abfcbc5d178b114ee01038b357d8487209493 (patch)
tree22e7e0250e9581d57790cc79265a0deb691cfdde /docs/src
parent69d518dd8c253d06884853f937fec3803c8a2af3 (diff)
downloadastro-8d7abfcbc5d178b114ee01038b357d8487209493.tar.gz
astro-8d7abfcbc5d178b114ee01038b357d8487209493.tar.zst
astro-8d7abfcbc5d178b114ee01038b357d8487209493.zip
Clarify rules of define:vars (#1937)
This is an attempt to make it clear that the provided arg to `define:vars` must be an object, and that the values must be serializable.
Diffstat (limited to 'docs/src')
-rw-r--r--docs/src/pages/migration/0.21.0.md7
1 files changed, 4 insertions, 3 deletions
diff --git a/docs/src/pages/migration/0.21.0.md b/docs/src/pages/migration/0.21.0.md
index cd04fdff7..58c049d5a 100644
--- a/docs/src/pages/migration/0.21.0.md
+++ b/docs/src/pages/migration/0.21.0.md
@@ -42,14 +42,15 @@ _These aliases are integrated automatically into [VSCode](https://code.visualstu
## Variables in Scripts & Styles
-In Astro v0.21, server-side variables can be passed into client-side `<style>` or `<script>`.
+In Astro v0.21, _serializable_ server-side variables can be passed into client-side `<style>` or `<script>`.
```astro
---
// tick.astro
-const colors = { foregroundColor: "rgb(221 243 228)", backgroundColor: "rgb(24 121 78)" }
+const foregroundColor = "rgb(221 243 228)";
+const backgroundColor = "rgb(24 121 78)";
---
-<style define:vars={colors}>
+<style define:vars={{foregroundColor, backgroundColor}}>
h-tick {
background-color: var(--backgroundColor);
border-radius: 50%;