Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use Polymer on JSFiddle?

I want to create quick prototypes of Polymer elements in a sandbox like JSFiddle or JavaScript Bin, but I can't get it working!

like image 598
Kayce Basques Avatar asked Dec 03 '15 19:12

Kayce Basques


1 Answers

Yes, you can, thanks to polygit.

Here's a boilerplate example you can fork: https://jsfiddle.net/kaycebasques/2q3fqehz/

HTML:

<base href="https://polygit.org/components/">
<script src="webcomponentsjs/webcomponents-lite.min.js"></script>
<link href="polymer/polymer.html" rel="import">

<dom-module id="x-example">
  <template>
    <style>
      :host {
        display: block;
      }
    </style>
    <h1>polyfiddle</h1>
  </template>
</dom-module>

<x-example></x-example>

JS:

// only need this when in the main document and on non-Chrome
addEventListener('WebComponentsReady', function() {
  Polymer({
    is: 'x-example'
  });
});
like image 116
Kayce Basques Avatar answered Sep 22 '22 07:09

Kayce Basques