Skip to content
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

HTML Templates instead of inline html in JS #165

Closed
raunakkathuria opened this issue Apr 21, 2014 · 4 comments
Closed

HTML Templates instead of inline html in JS #165

raunakkathuria opened this issue Apr 21, 2014 · 4 comments
Milestone

Comments

@raunakkathuria
Copy link

As of now we have to define all the html in the manifest.js (can you explain if possible why this implementation was favored)

screen shot 2014-04-21 at 8 14 14 pm

Is there any other way like creating html templates and referring them the way we refer css/js i.e. by specifying the url like this

screen shot 2014-04-21 at 8 17 06 pm

I think it will separate out the structure and will help in modularity.

@brianbaker brianbaker added this to the 2.0 milestone Apr 21, 2014
@brianbaker brianbaker added the v2 label Apr 21, 2014
@brianbaker
Copy link
Member

There are two main reasons in F2 version 1 that all of the html is in the AppManifest:

  1. Specifying templates by url will only work when the container and the app are run on the same domain OR when the browser and apps support CORS
  2. It cuts down on an extra HTTP request after the app has made it to the page (in order to retrieve data, etc.) because an app could be fully rendered when returned via the AppManifest

There's definitely a need to have first-class support for templates and as such I've gone ahead and labeled this question "v2" so we can look how to best support templates in F2 version 2. The cross-domain issue could likely be resolved by developers using an AMD optimizer (like r.js) along with a plugin like text! which will inline any templates into an AMD module.

@raunakkathuria
Copy link
Author

Thanks for the reply. I agree with the CORS point but url can contain the relative path so its in same folder as application. In terms of template it can be basics html also for initial stages. My main concern was if the html(basic structure) is quite big for large scale application and which is already in place then to write it again as per considering all the proper indentation or enclosing it in quotes properly can lead to lots of rework.

Waiting eagerly for V2.

@brianbaker
Copy link
Member

There's also the possibility of having a dynamically generated manifest file. I'm not sure what server-side language you're using, but there are some examples in PHP or C# that demonstrate dynamically generating the html rather than having it hard-coded. Many of the apps in existence today follow this route.

That said, there has been feedback against having dynamically generated manifests so having better support for static manifest files is a must. Keep an eye out to the Issues and v2 branch if you're curious on the progress of v2.

@SViradiya-Fintech
Copy link

hi we are using openf2 with multiple financial apps, it is around 35 apps., we use javascript framework,
we have html, manifiest js, and appclass js. so when ever we do some design releated changes in html, we have to minify html and put it in manifiest file. some time during copy paste, we wrongly copy paste in other application folder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants