Skip to content

RFC: Collections #17

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

Open
giuseppeg opened this issue Feb 19, 2021 · 0 comments
Open

RFC: Collections #17

giuseppeg opened this issue Feb 19, 2021 · 0 comments
Labels
help wanted Extra attention is needed RFC request for comments

Comments

@giuseppeg
Copy link
Owner

giuseppeg commented Feb 19, 2021

⚠️ this feature is strictly related to the data cascade proposal from #16 and probably should be implemented either together or after the data cascade is implemented.

xm should be able to render collections of data. For this I imagined we could use a <fill> tag with a new attribute called from (name can be changed).

from takes an array of flat objects (a string of JSON), iterates over them and repeats its content while filling the slots:

EniH6fWW4AAgNU1

For advanced use cases from accepts:

  • glob patterns (grab fills from other HTML files)
  • JSON file paths
  • path to a JS module that exports an array or a function
  • path to a JS module that exports an async function

EniI0OWXcAITSQ0

The async function version is super powerful 💣

async functions can be used to fetch data from an API, database and perform any other asynchronous operation!

EniJ0LmXYAAMQXk

@giuseppeg giuseppeg added the help wanted Extra attention is needed label Feb 19, 2021
@giuseppeg giuseppeg changed the title Collections RFC: Collections Feb 19, 2021
@giuseppeg giuseppeg added the RFC request for comments label Feb 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed RFC request for comments
Projects
None yet
Development

No branches or pull requests

1 participant