Project to Generate a Single JavaScript file for each browser.

49 views
Skip to first unread message

Martin Kersten

unread,
Dec 17, 2013, 9:20:12 AM12/17/13
to google-we...@googlegroups.com
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?


Thanks,

Martin (Kersten),
Germany

Thomas Broyer

unread,
Dec 17, 2013, 9:44:56 AM12/17/13
to google-we...@googlegroups.com
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)

Martin Kersten

unread,
Dec 17, 2013, 7:09:41 PM12/17/13
to google-we...@googlegroups.com
Hello Mr. Broyer,

    Thanks for the information. This is exactly what I am aiming for. Do you know any open source project that uses this kind of setup (so I can take a look) or do you know any Googler willing to share the needed information?


Thanks,

Martin (Kersten),
Köthen,
Germany
Reply all
Reply to author
Forward
0 new messages