MediaMath / strand

A collection of modular, reusable Web Components built upon Polymer
http://mediamath.github.io/strand/
BSD 3-Clause "New" or "Revised" License
119 stars 46 forks source link

Strand in a google chrome extension? #88

Closed Freid001 closed 8 years ago

Freid001 commented 8 years ago

Hi,

I would like to use strand in a google chrome extension I am currently developing. I have installed strand via bower etc. as per the documentation and imported the strand.html file in the head of my popup.html file.

In the popup.html file I have included two strand buttons. When I go to try the extension out in the browser all the strand files are being imported into the head. However the buttons are not output correctly, instead just the text of the buttons is displayed. If I view the popup.html directly from the browser then it is all fine and the strand buttons display correctly.

I'm not sure if this has something to do with CSP of chrome extensions? I have tried using polybuild a open source github repo to resolve this issue but have had no luck.

Is there anything you would recommend? Have you come across this issue before?

Thanks, Fraser

dlasky commented 8 years ago

potentially CSP, but i'm also not sure what the packaging requirements are for a chrome extension, so i'm suspicious if its just ignoring the other local files when its built.

Another option would be to use google's vulcanize tool to bundle everything into a single html file (in this case that would be popup i'd imagine)

Edit: definitely CSP

https://github.com/Polymer/polymer/issues/762#issuecomment-126562218

If you add a build step with Crisper in it that should sort you out.

Freid001 commented 8 years ago

Thanks Dan, the google vulcanize tool did the trick for the buttons.

However when I try using the strand-grid I get an evalerror. I have only included the html file which vulcanize generated as when I include the js one too the buttons also dont work.

image

Chrome does allow you to relax the CSP in the manifest for the extension but I don't really feel that is the right way of fixing the issue.

dlasky commented 8 years ago

as you can see we havent heavily tested in CSP... grid does a lot of internal rewriting for item pooling so thats likely the culprit. Is there any way to get a better trace in your setup?

dlasky commented 8 years ago

closing due to inactivity. Please reach out via internal channels if you need additional support.