-
Notifications
You must be signed in to change notification settings - Fork 123
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
Ability to return rendered html template #406
Comments
I can tell you that in our case, often, we handle this scenario by having some kind of "skeleton" page that already includes the component by making a request to the component on the server side. This is because in our case the Nevertheless, I would be ok with a PR for what you are purposing. Would you be able to? |
I see. I guess alternatively it would be "convenient" to support something like this in the cli itself. Consumers could provide a template html file that you use to include global stylesheets, dependencies, containers etc. Something like Btw I guess this is in some way linked to #407. I'll see how we get on with creating a simple test harness which would live locally to the component code. |
I like that. Perhaps if component's package.json would have a <html>
...
{{renderedComponent}}
...and/or
<oc-component href="{{baseUrl}}my-component?parameter=12345"></oc-component>
<script src="{{baseUrl}}oc-client/client.js"></script>
...
</html> Then we could use that on the UI too to be used as preview too. Like What do you think? /cc @nickbalestra @chriscartlidge @mattiaerre @pbazydlo |
@matthewdavidson I am always interested in testing strategies; when you say e2e why you do not just exercise your environment that is hosting the component? in this case, you will be also able to see how your component behaves in the context where it will be embedded. Having said that a way of server side rendering the component at the registry level is not a bad Idea at all. I am proposing a different approach (just a random idea really): what about:
// cc @matteofigus |
We've stumbled across the following scenario:
~preview
endpoint isn't ideal - it's not a true test as it's not what would happen on production (additionally we'd have to writewaitFor
type code to compensate for the client side injection process)One possible solution would be to extend the Registry API to accept a custom
Accept
header (similar to what we do for unrendered components i.e.Accept:application/vnd.oc.unrendered+json
) to just return the rendered html string. Example:Normal request:
New "rendered html" request:
Thoughts? 😇
The text was updated successfully, but these errors were encountered: