Can I use Polymer on JSFiddle?
Asked Answered
N

1

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!

Nothingness answered 3/12, 2015 at 19:42 Comment(0)
N
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'
  });
});
Nothingness answered 3/12, 2015 at 19:45 Comment(3)
Use <base href="http://polygit.org/polymer+:master/components/"> as base to point to the master! :)Glaciology
The jsfiddle is not working for me. I get ERR_CONNECTION_REFUSED when it tries to get the filesTamper
@Tamper it's working now... I know that the maintainers of 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.Nothingness

© 2022 - 2024 — McMap. All rights reserved.