Last active
September 5, 2017 22:20
-
-
Save Scarygami/501a5d9f8c35c4a85380cbbf8203aca1 to your computer and use it in GitHub Desktop.
Samples and code snippets for my Polymer in Production article series
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Polymer 1.x --> | |
<link rel="import" href="../polymer/polymer.html"> | |
<dom-module id="my-name"> | |
<template> | |
<style> | |
/* Amazing CSS to make my-name shine goes here */ | |
</style> | |
<span>[[firstname]] [[lastname]]</span> | |
<template> | |
<script> | |
Polymer({ | |
is: 'my-name', | |
properties: { | |
firstname: String, | |
lastname: String | |
} | |
}); | |
</script> | |
</dom-module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Polymer 2.x --> | |
<link rel="import" href="../polymer/polymer-element.html"> | |
<dom-module id="my-name"> | |
<template> | |
<style> | |
/* Amazing CSS to make my-name shine goes here */ | |
</style> | |
<span>[[firstname]] [[lastname]]</span> | |
<template> | |
<script> | |
class MyName extends Polymer.Element { | |
static get is() { return 'my-name'; } | |
static get properties() { | |
return { | |
firstname: String, | |
lastname: String | |
}; | |
} | |
} | |
window.customElements.define(MyName.is, MyName); | |
</script> | |
</dom-module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Polymer 3.x - warning, early preview, things might change */ | |
import { Element } from '../../@polymer/polymer/polymer-element.js'; | |
class MyName extends Element { | |
static get template() { | |
return ` | |
<style> | |
/* Amazing CSS to make my-name shine goes here */ | |
</style> | |
<span>[[firstname]] [[lastname]]</span> | |
`; | |
} | |
static get is() { return 'my-name'; } | |
static get properties() { | |
return { | |
firstname: String, | |
lastname: String | |
}; | |
} | |
} | |
window.customElements.define(MyName.is, MyName); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment