7

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

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
Kayce Basques
  • 23,849
  • 11
  • 86
  • 120

1 Answers1

10

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'
  });
});
Kayce Basques
  • 23,849
  • 11
  • 86
  • 120
  • 1
    Use `` as base to point to the master! :) – Pascal Gula Dec 03 '15 at 20:05
  • The jsfiddle is not working for me. I get ERR_CONNECTION_REFUSED when it tries to get the files – Gilberg Mar 02 '16 at 00:16
  • @Gilberg it's working now... I know that the maintainers of [polygit](https://github.com/PolymerLabs/polygit) have been doing work on its infrastructure which has been causing issues over the last couple of weeks and would explain why you were seeing that error. – Kayce Basques Mar 06 '16 at 23:25