{"action":"created","issue":{"url":"https://api.github.com/repos/caolan/magery/issues/25","repository_url":"https://api.github.com/repos/caolan/magery","labels_url":"https://api.github.com/repos/caolan/magery/issues/25/labels{/name}","comments_url":"https://api.github.com/repos/caolan/magery/issues/25/comments","events_url":"https://api.github.com/repos/caolan/magery/issues/25/events","html_url":"https://github.com/caolan/magery/issues/25","id":295520910,"number":25,"title":"Terminology: pages vs. components","user":{"login":"caolan","id":5274,"avatar_url":"https://avatars0.githubusercontent.com/u/5274?v=4","gravatar_id":"","url":"https://api.github.com/users/caolan","html_url":"https://github.com/caolan","followers_url":"https://api.github.com/users/caolan/followers","following_url":"https://api.github.com/users/caolan/following{/other_user}","gists_url":"https://api.github.com/users/caolan/gists{/gist_id}","starred_url":"https://api.github.com/users/caolan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caolan/subscriptions","organizations_url":"https://api.github.com/users/caolan/orgs","repos_url":"https://api.github.com/users/caolan/repos","events_url":"https://api.github.com/users/caolan/events{/privacy}","received_events_url":"https://api.github.com/users/caolan/received_events","type":"User","site_admin":false},"labels":[{"id":390007180,"url":"https://api.github.com/repos/caolan/magery/labels/discussion","name":"discussion","color":"1d76db","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-02-08T13:56:39Z","updated_at":"2018-02-08T14:09:43Z","closed_at":null,"author_association":"OWNER","body":"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.\r\n\r\nI'm proposing we call all current templates using custom tags 'components', and we introduce a concept of 'pages' for use with server-side implementations.\r\n\r\nA page might look something like this:\r\n\r\n```html\r\n<!DOCTYPE html>\r\n<html>\r\n  <head>\r\n    <title>{{ page.title }}</title>\r\n  </head>\r\n  <body>\r\n    <h1>Profile</h1>\r\n    <my-component user=\"{{ user }}\"></my-component>\r\n  </body>\r\n</html>\r\n```\r\n\r\nWhich makes use of a component defined like this:\r\n\r\n```html\r\n<template data-tagname=\"my-component\">\r\n  Hello, {{ user.name }}!\r\n</template>\r\n```\r\n\r\nIn the server-side library you would call separate functions/methods/whatever to load components and pages, for example:\r\n\r\n```python\r\nmagery.load_components(\"./templates/components\")\r\nmagery.load_pages(\"./templates/pages\")\r\n```\r\n\r\nComponents would be rendered using their tag name:\r\n\r\n```python\r\nmagery.render_component(\"my-component\", data)\r\n```\r\n\r\nAnd pages would be rendered using the path to the template file:\r\n\r\n```python\r\nmagery.render_page(\"project/example.html\", data)\r\n```\r\n\r\nExactly 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."},"comment":{"url":"https://api.github.com/repos/caolan/magery/issues/comments/364122222","html_url":"https://github.com/caolan/magery/issues/25#issuecomment-364122222","issue_url":"https://api.github.com/repos/caolan/magery/issues/25","id":364122222,"user":{"login":"caolan","id":5274,"avatar_url":"https://avatars0.githubusercontent.com/u/5274?v=4","gravatar_id":"","url":"https://api.github.com/users/caolan","html_url":"https://github.com/caolan","followers_url":"https://api.github.com/users/caolan/followers","following_url":"https://api.github.com/users/caolan/following{/other_user}","gists_url":"https://api.github.com/users/caolan/gists{/gist_id}","starred_url":"https://api.github.com/users/caolan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caolan/subscriptions","organizations_url":"https://api.github.com/users/caolan/orgs","repos_url":"https://api.github.com/users/caolan/repos","events_url":"https://api.github.com/users/caolan/events{/privacy}","received_events_url":"https://api.github.com/users/caolan/received_events","type":"User","site_admin":false},"created_at":"2018-02-08T14:09:43Z","updated_at":"2018-02-08T14:09:43Z","author_association":"OWNER","body":"In which case `pages` should just be referred to as `files` so it's clear you're simply rendering the whole file:\r\n\r\n```python\r\nmagery.render_component(\"my-component\", data)\r\nmagery.render_file(\"path/to/file.html\", data)\r\n```"}}
{"actor":{"display_login":"caolan"}}