Managing private/shared elements?

138 views
Skip to first unread message

Keith Garrod

unread,
Jul 22, 2014, 12:41:13 PM7/22/14
to polym...@googlegroups.com
I am trying to create a collection of elements that can be shared between multiple private projects. 

I want to include testing (polymer-test-tools) and to use my own components in Polymer designer. I am finding it challenging to set up a directory structure which supports private/shared elements and is consistent with the existing toolset. 

The tooling seems to be geared towards creating a repository for each element. That's all very well for public elements, but not so great for private/shared elements. My private/shared collection will easily exceed 50 elements (github large plan). Apart from anything else, that's $1/month/element, which seems like a lot for hosting a few lines of code!

I do understand that the tooling is nascent, but I am wildly excited about the potential of Polymer for my project and would really appreciate any pointers .

Rob Dodson

unread,
Jul 22, 2014, 1:52:33 PM7/22/14
to Keith Garrod, polymer-dev
Would it be possible for you to create one private repo that contains all of your element definitions? Have you tried that and run up against a problem?


Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/d49637dc-5775-4f6e-a2a4-d1b53123c3ee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Keith Garrod

unread,
Jul 23, 2014, 5:02:43 AM7/23/14
to polym...@googlegroups.com, kpga...@gmail.com
Yes, I am trying to create one private repo with all of my element definitions. 

I think the crux of it is that each of my elements is in a child directory of my private/shared elements project (call it 'all_my_elements')

I have added 'all_my_elements' as a dependency to my designer project's bower.json.

I have added 'components/all_my_elements/metadata.html' to the metadata array. It contains a link to a metadata file for each of my elements.

The problem is, that the element definitions themselves are not found by the designer, seemingly because the source of the element is in  'components/all_my_elements/my_example_element' and not  'components/my_example_element'.

If I copy 'components/all_my_elements/my_example_element' to 'components/my_example_element', the designer finds the element and shows it in the palette with the correct metadata.

A hack I found was to add my_example_element as a file-pointer dependency to the bower.json of all_my_elements. It kinda worked but messed up the tests in all_my_elements, so is not a practical solution.

I hope that makes sense. Let me know if you need to see some code. It's a bit cumbersome to post because it's spread across two repositories. 

Scott Miles

unread,
Jul 23, 2014, 5:10:00 AM7/23/14
to Keith Garrod, polymer-dev
The paths in `components/all_my_elements/metadata.html` are relevant, can you provide a sample?


Keith Garrod

unread,
Jul 23, 2014, 5:19:38 AM7/23/14
to polym...@googlegroups.com
components/all_my_elements/metadata is just this:
   
 <link rel="import" href="../seed-element/metadata.html">

components/all_my_elements/seed_element/metadata.html:

<x-meta id="seed-element" label="Seed" isContainer group="Test">


 
<template>


   
<section style="width: 200px; height: 300px;" layout vertical></section>


 
</template>
 
<property name="author"
           
kind="text">
 
</property>
</x-meta>


Scott Miles

unread,
Jul 23, 2014, 5:25:17 AM7/23/14
to Keith Garrod, polymer-dev
Try adding:

  <template id="imports">
    <link rel="import" href="seed-element.html">
  </template>

To your metadata.html (inside the x-meta).


Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.

Keith Garrod

unread,
Jul 23, 2014, 6:12:50 AM7/23/14
to polym...@googlegroups.com
Thanks for the quick response Scott. I thought I would have to wait for Pacific Time :).

Just to be sure, you mean that  `components/all_my_elements/seed-element/metadata.html` should look like this:

<x-meta id="seed-element" label="Seed" isContainer group="Test">

 
<template id="imports">
   
<link rel="import" href="seed-element.html">
 
</template>

 
<template>


   
<section style="width: 200px; height: 300px;" layout vertical></section>


 
</template>
 
<property name="author"
           
kind="text">
 
</property>
</x-meta>

I tried that and get the same result - my element does not appear in the palette. 



On Tuesday, July 22, 2014 6:41:13 PM UTC+2, Keith Garrod wrote:
Message has been deleted
Message has been deleted

Keith Garrod

unread,
Jul 28, 2014, 10:27:21 AM7/28/14
to polym...@googlegroups.com
In case somebody else needs to create a collection of private/shared elements, I discovered that bitbucket offers unlimited private git repositories on their free plan (<= 5 collaborators). This means that I am able to use the seed-element flow to create a repository per element and just change the repository link to point to bitbucket instead of github. The steps to publish the github pages documentation presumably won't work, but as it's a private collection, I'm not bothered. 


On Tuesday, July 22, 2014 6:41:13 PM UTC+2, Keith Garrod wrote:

Rob Dodson

unread,
Jul 29, 2014, 7:28:47 PM7/29/14
to Keith Garrod, polymer-dev
I think I found the issue. In your element's metadata.html, move the import underneath the element stub.

ex:

<x-meta id="my-element-template" label="Template" group="My Elements">
  <template>
    <div style="width: 200px; height: 200px; background: red;"></div>
  </template>

  <template id="imports">
    <link rel="import" href="my-element-template.html">
  </template>
</x-meta>


On Thu, Jul 24, 2014 at 6:04 AM, Keith Garrod <kpga...@gmail.com> wrote:
I am still having a problem with this. Although my element appears correctly in the palette, it doesn't show on the canvas if I drag it there. I've published my code, with a simple element in it here: https://github.com/kpgarrod/my-shared-polymer-elements.

What am I missing now?

Thanks,

Keith



On Tuesday, July 22, 2014 6:41:13 PM UTC+2, Keith Garrod wrote:

Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages