Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polymer 2.0 elements #52

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Created snippet for polymer 2.0 element
nkrim committed Mar 15, 2017
commit 952822622076b3fd8cec84c79204a24179d5a119
53 changes: 53 additions & 0 deletions polymer-2-element.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<snippet>
<content><![CDATA[
<link rel="import" href="$1/polymer/polymer.html">

<!--
A comment describing this element

Example:

<my-elem></my-elem>

Example:

<my-elem>
<h2>Hello my-elem</h2>
</my-elem>

@demo demo/index.html
-->

<dom-module id="$2">
<template>
<style>
:host {
display: block;
}
</style>
${0:<h2>Hello [[prop1]]</h2>}
</template>

<script>
class ${2/(?:\<(\w)(\w*)\>)?\W*/\u$1\L$2\E/g} extends Polymer.Element {
static get is() { return '$2'; }
static get properties() {
return {
prop1: {
type: String,
value: '$2'
}
};
}
}

window.customElements.define(${2/(?:\<(\w)(\w*)\>)?\W*/\u$1\L$2\E/g}.is, ${2/(?:\<(\w)(\w*)\>)?\W*/\u$1\L$2\E/g});
</script>
</dom-module>
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>pe2</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>text.html</scope>
<description>polymer 2.0 element</description>
</snippet>