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

Access to a astro.renderToString method? #4372

Closed
reggi opened this issue Aug 17, 2022 · 4 comments
Closed

Access to a astro.renderToString method? #4372

reggi opened this issue Aug 17, 2022 · 4 comments

Comments

@reggi
Copy link

reggi commented Aug 17, 2022

I've dug into the code but I couldn't find any mention / Astro api that would allow me to pass in a .astro file and spit out HTML. Something like react.renderToString. Does this exist?

Not sure if this would live within the Astro global, or just within the package something like:

import astro from 'astro'
import Example from './example.astro'

astro.renderToString(Example, { prop: true })

or

import astro from 'astro'
astro.renderToString('./example.astro', { prop: true })
@reggi reggi changed the title Access to a Astro.renderToString method? Access to a astro.renderToString method? Aug 17, 2022
@reggi
Copy link
Author

reggi commented Aug 17, 2022

For context on why I'm trying to do this. I'd like to be able to have an API endpoint that returns an astro component HTML. That's pretty much it. I think it would be cool.

@bluwy
Copy link
Member

bluwy commented Aug 18, 2022

Recently used the Astro compiler which might be similar to what you're looking for, though it's still a bit internal-ish to use AFAIA.

Anyways, the issues here are usually for bug reports. For feature requests, please open at https://github.com/withastro/rfcs/discussions! You might get better awareness there.

@bluwy bluwy closed this as not planned Won't fix, can't repro, duplicate, stale Aug 18, 2022
@reggi
Copy link
Author

reggi commented Aug 18, 2022

Ok closing out opened discussion here: withastro/roadmap#254

@waspeer
Copy link

waspeer commented Dec 7, 2022

I opened a discussion in the RFC category for this here: withastro/roadmap#409

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

No branches or pull requests

3 participants