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
Show file tree
Hide file tree
Changes from all commits
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
49 changes: 49 additions & 0 deletions polymer-2-element-stylesheet.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<snippet>
<content><![CDATA[
<link rel="import" href="${1:../../bower_components}/polymer/polymer.html">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this not be polymer/polymer-element.html now?


<!--
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">
<link rel="import" type="css" href="$3.css">
<template>
${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>pes2</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>text.html</scope>
<description>polymer 2.0 element, external styles</description>
</snippet>
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:../../bower_components}/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>