Polymer / polymer-starter-kit

A starting point for Polymer apps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

basePath not working as expected

Wiering opened this issue · comments

I'm trying to run this app on a subdirectory on my domain at mydomain.com/polymertest/

So, according to index.html, I add "basePath": "polymertest", to polymer.json, and after building, the code now contains <base href="/polymertest/">

This works partially, the app loads the top and left sidebar, but the content part says: Oops you hit a 404. Head back to home (and home links to mydomain.com instead of mydomain.com/polymertest/).

Now, if I click View One in the menu, it actually works, but the url changes to mydomain.com/view1 which is wrong (the same with View Two and View Three).

Of course, if I go to mydomain.com/view1, the page is not found. But mydomain.com/polymertest/view1 doesn't work either.

I would write it as an absolute path like "/polymertest/", and you should also edit this line.

If you're not using differential serving[1][2], you can use basePath in polymer.json for both by changing it to:

window.Polymer = {rootPath: document.querySelector('base').href};

The base tag handles resolving file and import paths, but without setting Polymer.rootPath the bindings used for the routes will still be set to the root path.