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

Add import function #132

Open
kaidesu opened this issue Dec 15, 2024 · 0 comments
Open

Add import function #132

kaidesu opened this issue Dec 15, 2024 · 0 comments

Comments

@kaidesu
Copy link
Member

kaidesu commented Dec 15, 2024

Ghost already supports importing modules using the following syntax:

import { Example } from 'example'

Adding an import function variant would allow developers to dynamically load in and assign values during runtime. For example, it would be possible to scan and auto-import a directory of ghost files:

files = scanDirectory('config')

for (file in files) {
  const config = import(file)

  // do something with "config"
}

This would re-use the existing import keyword but would be invoked as a function.

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

1 participant