-
-
Notifications
You must be signed in to change notification settings - Fork 293
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
server-side template rendering stack #389
Conversation
@alexhumphreys happy to get your opinion on any of the design issues or other checkbox items above |
@jondot I'm sure you know more than me on this, but I'll give my opinions on the few where I have one: Open tech issues:
I guess the solution will eventually involve
Tried to add a few here, wouldn't say they were good, but could be a place to start.
Good question! I genuinely don't know, I kinda just took it from the example in the fluent-template README. Open design questions:
Agreed. I guess a lot of things that need to be passed are paths, if there's standard locations for these in the
Good question. I can see arguments for either nothing, or for a minimal example that's easy to extend.
Not sure what you mean by "if i18n does not exist physically"
@slyons mentioned feature gating here, which seems like a good idea. No clue on opt-in vs opt-out, maybe it depends what kind of app you're generating?
Agree. I guess one can't have fully transparent template swapping anyway, the templates themselves probably have different syntax and need different args. |
@alexhumphreys rendering is now feature complete with API that should work for all scenarios (including building a custom view engine). happy to take comments relating to ergonomics, usability and ideas that we can add. Some more decisions that happened:
luck has it, that from what I see we need no configuration at all. |
Nice one, thanks for all the work on this! Testing now on If I come up with a nice way to deal with extracting the locale header and passing it to the |
Based off #385
Started design principles:
assets
, where any runtime asset go into, except configuration. this means we have a tally of 3 objects to deploy with server-side template rendering.assets/templates
assets/i18n
, sharedftl
is calledshared.ftl
to more simply indicate what it is (instead ofcore.ftl
)t
rather thanfluent
avoiding using implementation-specific things unless must (so we can swap out components)Open tech issues:
unwrap
s,expect
s, and remove them when possibleOpen design questions
loco generate
(probably: views, but maybe initializer and wiring into app hooks?)conclusions
rendering ergonomics
Notes:
render
becomes a pit of success. by typingrender::
you get a list of all the things you can do which is a Good Thing. Adding a "render type" is giving the user more cognitive load and only should be a secondary thing.view generator
yes. creating files in the correct opinionated structure is what's expected from the framework: "where you have strong opinions, have a generator supporting it".
generate view accounts/dashboard --i18n
(topic/page). thei18n
flag will create thei18n
base structure if missing (folders, shared, etc.), and then add aen-US/ ???
(need to see if we can follow aaccounts/dashboard.ftl
structure, or justaccounts_dashboard.ftl
. **this also means we're calling the "thing"view
.editor notes: do we want
generate template
instead? bothview
andtemplates
are overloaded. Also, if we go withgenerate view
this means its better the whole feature must be part of Loco with no option to remove it. I think we already "payed" fortera
so no harm done there (we'll pay extra for fluent-templates, but maybe thats OK)