serving polymer bundles conditionally -


what options service polymer es6-bundle,es5-bundle , unbundled versions conditionally ?

preferred option nginx if that's possible, how detect http2 , if there's regex user agent detect es6

i have found next solution:

on backend should define map so:

map $cookie_build $assets_suffix {     ""    "";     "no"             "";     "es6-bundled"    "build/es6-bundled/";     "es6-unbundled"  "build/es6-unbundled/";     "es5-bundled"    "build/es5-bundled/"; } 

and polymer's assets location define this

location /polymer-app/ {     alias /app/public/frontend/$assets_suffix;     try_files $uri $uri/ /polymer-app/index.html; } 

so, default, nginx serves development build, , when there defined cookie build version serves appropriate build of application.

on clientside

you should detect browser capabilities example using gist https://gist.github.com/dabs/89ccc2ffd1d435efdacff05248514f38 or other feature-detect-* library should set corresponding cookie , call window.location.reload(true).

in case, have separate landing page based on cms, browser detection processed on , when user hits application, corresponding cookie set.


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -