Tools: Feature request: configure effective web root

Created on 15 Jun 2016  ·  12Comments  ·  Source: Polymer/tools

I would like to be able to configure the Polymer CLI to treat a sub-directory of my project as the effective web root when building assets. Assuming the following contrived structure:

  |_ public
       |_ index.html
       |_ bower_components/some-dep/some-dep.html

And the following contrived contents of index.html:

<!doctype html>
<html>
  <head>
    <link rel="import" href="/bower_components/some-dep/some-dep.html">
  </head>
</html>

I would like to configure my polymer build step so that it correctly treats the web root as public (not the root of my project directory).

Build cli High Available Enhancement

Most helpful comment

Any news? I'm interested in have something like this:

screen shot 2016-10-14 at 15 23 44

All 12 comments

See #277, this is an issue for people migrating from PSK

You can currently do this by setting a root property via CLI flags (polymer.json supports this property as well but there is currently a bug, see https://github.com/Polymer/polymer-build/issues/34).

polymer build --root public/
polymer serve --root public/

One constraint to keep in mind is that your root really is the "root" of your application, so anything above/outside of your root directory will be inaccessible. So no reaching outside of root for bower_components, manifest.json, etc.

@FredKSchott When I discussed this issue with @justinfagnani , he assured me that root was misleading, and not actually a configuration intended to address the feature request above. Perhaps he can comment more on this..

I think we may have confused your request with needing to serve an application from a path other than the root URL. The way I understand the feature request, you'd like public/ to be your web root instead of the project working directory, which is what root is supposed to let you do.

@robdodson had a similar request yesterday which we helped him work through, does this sound similar? https://polymer.slack.com/archives/ecosystem-eng/p1473273440000065

@FredKSchott I don't think I have access to that Slack archive.

whoops, try now

After trying to use root to address my use case, I can confirm that one of the two things must be true:

  1. root is broken
  2. root does not address the described use case

@cdata if you're reaching that conclusion from the investigation you posted in our Slack channel, I believe your issue exists somewhere else. We've just integrated the new analyzer into polymer-build, so once we hook up error handling you should be able to get a much better idea of what's failing (vs. the current silently failing horribleness).

Any news? I'm interested in have something like this:

screen shot 2016-10-14 at 15 23 44

Er, this is still an issue for me. Also, I tend to have multiple public directories in my projects, so I can group together server and client code for a self-contained module. This means having one root doesn't work for me either. For that to work I'd have to have all of my public code in one public directory.

Seems like the best solution would be to let me specify multiple roots, or better, yet, have it figure out where the code is.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This feature request still stands 💁‍♂️

Was this page helpful?
0 / 5 - 0 ratings