Skip to content

Instantly share code, notes, and snippets.

@cletusw
Last active December 21, 2015 01:19
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cletusw/6226703 to your computer and use it in GitHub Desktop.
Save cletusw/6226703 to your computer and use it in GitHub Desktop.
Here's a Sublime Text snippet for quickly creating polymer-elements. Just type "<polymer" and press TAB to generate the empty element, then tab through the different fields to add a name (which is automatically mirrored to the Polymer() call), attribute default values in the prototype (which are automatically mirrored to the "attributes" attribu…
<snippet>
<content><![CDATA[
<link rel="import" href="../../bower_components/polymer/polymer.html">
<polymer-element name="$1" attributes="${2/:[^\n$]*(\n[ \t]*|$)/ /g}">
<template>
<style>
:host {
display: block;
}
</style>$3
</template>
<script>
Polymer('$1', {
$2
});
</script>
</polymer-element>
]]></content>
<tabTrigger>&lt;polymer</tabTrigger>
</snippet>
@cletusw
Copy link
Author

cletusw commented Aug 14, 2013

I had to turn off parenthesis/quotation mark/etc auto matching by adding "auto_match_enabled": false to my settings, otherwise Sublime would stop mirroring to the "attributes" attribute the minute I typed an opening parenthesis/quotation mark/etc. Does anyone know how to allow auto-matching and still stay in the cool Snippets mirroring mode?

@cletusw
Copy link
Author

cletusw commented Jan 3, 2014

Using ":host" instead of deprecated "@host".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment