yeoman / generator-polymer

Scaffold out a Polymer project
http://polymer-project.org
926 stars 149 forks source link

Where to put element-specific resource files? #203

Closed danhawkes closed 9 years ago

danhawkes commented 9 years ago

Intuitively, I want to put them in the element's directory, e.g. elements/my-element/resource.json, and reference them with a relative path like …url="resource.json".

This works in the serve build because it serves directly from the app/elements directory, but not in the serve:dist build, because it only copies html files into dist (presumably just for vulcanization).

I guess what I'm asking is: should the copy task move non html/js/css files in element subdirectories into the dist/elements directory? E.g.

elements
    my-element
        resource.json
        some-directory
            file.txt

elements
    resource.json
    some-directory
        file.txt

Obviously it'd have to deal with collisions somehow (throw error/namespacing?).

Alternatively, if it's assumed that resource files are placed somewhere relative to the root (like images are now), how can they be referenced inside an element without using absolute paths?

robdodson commented 9 years ago

Hey @danhawkes would you mind opening this question over on the Polymer Starter Kit repo? We're pulling directly from that project now so any changes will need to occur upstream over there.

https://github.com/polymerelements/polymer-starter-kit/issues