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

[Feature Request] GDM codeblocks can import/export between each other #1892

Open
sukima opened this issue Jan 6, 2025 · 1 comment
Open

Comments

@sukima
Copy link

sukima commented Jan 6, 2025

In GDM modes helpful for documentation I often wish I could show (preview) the implementation of a component, helper, modifier, etc. write some documentation and then show live examples of their use.

Currently to do this the entire implementation must be copy/pasted in every codeblock as there is not a way to import something from an earlier code block.

Suggestion

Offer a way to register a filename for a codeblock allowing other codeblocks to import them using a ./ relative path.

Perhaps maybe with a filename:{FILENAME} in the codefence metadata line?

@NullVoxPopuli
Copy link
Owner

I'm a big fan -- based on your suggestion, it could look like this:

text here in md

```gjs live filename="demo-a"
export const DemoA = <template> ... </template>

<template>
  <DemoA />
</template>
```

```gjs live
import { DemoA } from './demo-a';

<template>
  Again! <DemoA />
</template>
```

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

2 participants