Skip to content

Instantly share code, notes, and snippets.

@nalbion
Created February 10, 2016 11:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nalbion/09435e331c607c045e15 to your computer and use it in GitHub Desktop.
Save nalbion/09435e331c607c045e15 to your computer and use it in GitHub Desktop.
IntelliJ live templates for working with PolymerTS
<!-- save to ~/.IntelliJIdea15/config/templates/PolymerTS.xml -->
<templateSet group="PolymerTS">
<template name="pe" value="&lt;dom-module id=&quot;$TITLE$&quot;&gt;&#10;&lt;style&gt;&#10;&#10;&lt;/style&gt;&#10;&lt;template&gt;&#10;$END$&#10;&lt;/template&gt;&#10;&lt;/dom-module&gt;&#10;&#10;&lt;script type=&quot;text/javascript&quot; src=&quot;$TITLE$.js&quot;&gt;&lt;/script&gt;&#10;" description="Polymer Element" toReformat="false" toShortenFQNames="true">
<variable name="TITLE" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="HTML_TEXT" value="true" />
<option name="HTML" value="true" />
</context>
</template>
<template name="@comp" value="/// &lt;reference path=&quot;../bower_components/polymer-ts/polymer-ts.d.ts&quot; /&gt;&#10;&#10;@component(&quot;$TITLE$&quot;)&#10;class $CLASS_NAME$ extends polymer.Base&#10;{&#10; $END$&#10;}&#10;&#10;// after the element is defined, we register it in Polymer&#10;$CLASS_NAME$.register();" description="Polymer Element TS class" toReformat="false" toShortenFQNames="true">
<variable name="TITLE" expression="fileNameWithoutExtension()" defaultValue="" alwaysStopAt="false" />
<variable name="CLASS_NAME" expression="groovyScript(&quot;\&quot;-${_1}\&quot;.replaceAll(/-[a-z]/) { str -&gt; str.substring(1).toUpperCase()}&quot;, TITLE)" defaultValue="" alwaysStopAt="false" />
<context>
<option name="TypeScript" value="true" />
</context>
</template>
</templateSet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment