Last active
October 28, 2020 13:17
-
-
Save herberthobregon/f86697482bc30c9f898b182bfd15fd4e to your computer and use it in GitHub Desktop.
Polymer 3 Code Template for WebStom, PhpStorm, All JetBrains IDE
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
#set($CLASS_NAME = "") | |
#set($part = "") | |
#if($NAME.endsWith(".js")) | |
#set($end = $NAME.length() - 3) | |
#set($NAME = "$NAME.substring(0,$end)") | |
#end | |
#foreach($part in $NAME.split("-")) | |
#set($CLASS_NAME = "${CLASS_NAME}$part.substring(0,1).toUpperCase()$part.substring(1).toLowerCase()") | |
#end | |
import { LitElement, html } from 'lit-element/lit-element.js'; | |
class ${CLASS_NAME} extends LitElement { | |
constructor() { | |
super(); | |
// Default properties can be set from the element's constructor | |
this.mood = "Hello ${NAME}" | |
} | |
static get properties() { | |
return { | |
mood: String | |
}; | |
} | |
render() { | |
return html` | |
<style> | |
:host { | |
display: block; | |
} | |
</style> | |
<div>Lit-element! ${this.mood}!</div> | |
`; | |
} | |
} | |
window.customElements.define('${NAME}', ${CLASS_NAME}); |
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
#set($CLASS_NAME = "") | |
#set($part = "") | |
#if($NAME.endsWith(".js")) | |
#set($end = $NAME.length() - 3) | |
#set($NAME = "$NAME.substring(0,$end)") | |
#end | |
#foreach($part in $NAME.split("-")) | |
#set($CLASS_NAME = "${CLASS_NAME}$part.substring(0,1).toUpperCase()$part.substring(1).toLowerCase()") | |
#end | |
import { PolymerElement, html } from '@polymer/polymer/polymer-element.js'; | |
class ${CLASS_NAME} extends PolymerElement { | |
static get properties() { | |
return {}; | |
} | |
static get template() { | |
return html` | |
<style> | |
:host { | |
display: block; | |
} | |
</style> | |
<div>Hola mundo! Polymer 3</div> | |
`; | |
} | |
} | |
window.customElements.define('${NAME}', ${CLASS_NAME}); |
Edited
Change _render to render
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add in
Settings > Editor > File and code Templates
now simply
right click in folder > new > [Name of your template]
Name: "my-element"