-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Docs: add .astro
Syntax guide
#137
Conversation
|
||
When you finally do need to introduce dynamic functionality, Astro allows you to _bring your own framework_, so you're free to use any component format you'd like without commiting to a holistic architectural approach up-front. "The big question" is deferred until it actually needs to be answered. | ||
|
||
During a long-term project, you might even decide to switch frameworks somewhere down the road. Since Astro decouples decisions about data-loading and static rendering from your framework, that decision has a much smaller impact—try out the new framework on a single page or even mix both frameworks on some pages while you migrate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
| Requires JS import | No | Yes, `jsxPragma` (`React` or `h`) must be in scope | | ||
| Fragments | Automatic | Wrap with `<Fragment>` or `<>` | | ||
| Mutliple frameworks per-file | Yes | No | | ||
| Modifying `<head>` | Just use `<head>` | Per-framework (`<Head>`, `<svelte:head>`, etc) | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha! 💯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love this! This is looking great. I don’t have any other feedback. Great covering of the entire concept in a very easy-to-read length.
`.astro` components can also accept props when they are rendered. Public props can be marked using the `export` keyword. | ||
|
||
Local values are overwritten when props are passed, otherwise they are considered the default value. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a pretty confusing/surprising API. Typically export
provides data to other modules, but this inverts that. I’m not sure I have a better solution in mind, but I’ll think on it if there’s interest on the Astro team.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair point. This is borrowed from Svelte's prop syntax. One benefit is that it makes it really easy to statically analyze for IDE support, but I agree that overloading the export
keyword isn't great.
Would be interested to hear alternative suggestions! I'll spin up a separate issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened #139!
Co-authored-by: Drew Powers <1369770+drwpow@users.noreply.github.com>
Changes
Adds
docs/syntax.md
to provide an overview of the Astro syntaxTesting
N/A
Docs