I want to create quick prototypes of Polymer elements in a sandbox like JSFiddle or JavaScript Bin, but I can't get it working!
Can I use Polymer on JSFiddle?
Asked Answered
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'
});
});
The jsfiddle is not working for me. I get ERR_CONNECTION_REFUSED when it tries to get the files –
Tamper
@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.
<base href="http://polygit.org/polymer+:master/components/">
as base to point to the master! :) – Glaciology