Re: Project to Generate a Single JavaScript file for each browser.
On Tuesday, December 17, 2013 3:20:12 PM UTC+1, Martin Kersten wrote:
Hi,
I am setting up a GWT project to produce the JavaScript code for a web site. The application is only
going to argument the dynamic elements of a web page providing the glue to hold everything dynamic
together by creating a single entry point and discovering the required functionality by inspecting the dom
tree on startup.
The HTML page is completely dynamic and is generated by a in-house framework meaning I am totally in control
over every aspect of page creation.
Since the JavaScript is developed independently at different speed, I want to be able to compile the project
to update the JS assets of another project and this newly compiled JS gets committed within the project.
To simplify the generation and usage and also to remove the clutter I want to have a single JavaScript file
for each browser version that my web page will draw from depending on the user-agent that is transmitted.
I also wonder what is needed in such a setup to debug the client code using the development mode. I guess
I have to run GWT with the -noserver argument and also add the ?code-server query parameter in the
web-framework. Right?
What you're trying to do is basically move the selection script to the server side. This is exactly what Google is doing for years (you'll find mentions of SSSS in comments, commits or issues, standing for Server-Side Selection Script).
What you need is a special Linker to output each permutation's script in a standalone script (rather than one that expects to be loaded by a JS selection script). I never really thought about how it would/should work so I'm afraid I can't provide more info on this (ask Googlers though; I believe they somehow extend CrossSiteIframeLinker).
To choose the right script to use, the CrossSiteIframeLinker generates a file with the property mappings which you should be able to use.
I wonder what kind of work would be needed if you have other binding properties than user.agent (and/or locale) that couldn't be determined on the server-side. Maybe you'd need to collapse those so that the selection script only deals with properties that can be computed on the server-side (again, ask Googlers if they can help).
And for DevMode, you'd have to load devmode.js somehow instead of your permutation. That can easily be triggered by the presence of ?gwt.codesvr in the query-string.
That said, I have no idea what's needed otherwise (e.g. if you want to use your server-side-computed property values)
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home