-
Notifications
You must be signed in to change notification settings - Fork 5
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
Terminology: pages vs. components #25
Comments
I think having two separate loading mechanisms might not be necessary. Instead of doing: magery.load_components("./templates/components")
magery.load_pages("./templates/pages") It could just be: magery.load_files("./templates") Which would populate both That means it would be possible for a single file to potentially define both a page and components: <!DOCTYPE html>
<html>
<head>
<title>Example</title>
</head>
<body>
<template data-tagname="my-component">
Hello, {{ name }}!
</template>
</body>
</html> With the above example both a |
In which case magery.render_component("my-component", data)
magery.render_file("path/to/file.html", data) |
It's not clear to me why we need a page concept. I think react use only components it allow to define content of the body and stuff in the header two (i think). What would pages bring to the table ? Except beeing a top level component ? |
Magery is designed around custom HTML5 template tags that called 'components' (though sometimes confusingly referred to as templates in our docs). On the server-side these need to be placed into a full HTML document to be useful, on the client-side only the components are used.
I'm proposing we call all current templates using custom tags 'components', and we introduce a concept of 'pages' for use with server-side implementations.
A page might look something like this:
Which makes use of a component defined like this:
In the server-side library you would call separate functions/methods/whatever to load components and pages, for example:
Components would be rendered using their tag name:
And pages would be rendered using the path to the template file:
Exactly how those server-side APIs look and how page paths are constructed will be up to server-side implementors - they can do whatever makes sense in their language.
The text was updated successfully, but these errors were encountered: