Sublime snippets for Polymer and Web Components
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
messages
.editorconfig
.gitignore
README.md
app-location.sublime-snippet
app-route.sublime-snippet
array-selector.sublime-snippet
carbon-location.sublime-snippet
carbon-route.sublime-snippet
custom-element.sublime-snippet
firebase-auth.sublime-snippet
html-import-iron-element.sublime-snippet
html-import-paper-element.sublime-snippet
html-import.sublime-snippet
html.sublime-snippet
iron-a11y-keys.sublime-snippet
iron-ajax.sublime-snippet
iron-autogrow-textarea.sublime-snippet
iron-collapse.sublime-snippet
iron-doc-viewer.sublime-snippet
iron-form.sublime-snippet
iron-icon.sublime-snippet
iron-iconset-svg.sublime-snippet
iron-iconset.sublime-snippet
iron-image.sublime-snippet
iron-input.sublime-snippet
iron-localstorage.sublime-snippet
iron-media-query.sublime-snippet
iron-meta.sublime-snippet
iron-pages.sublime-snippet
iron-selector.sublime-snippet
messages.json
neon-animated-pages.sublime-snippet
package.json
paper-autogrow-textarea.sublime-snippet
paper-button.sublime-snippet
paper-card.sublime-snippet
paper-checkbox.sublime-snippet
paper-dialog-scrollable.sublime-snippet
paper-dialog.sublime-snippet
paper-drawer-panel.sublime-snippet
paper-fab.sublime-snippet
paper-header-panel.sublime-snippet
paper-icon-button.sublime-snippet
paper-input.sublime-snippet
paper-item.sublime-snippet
paper-material.sublime-snippet
paper-menu.sublime-snippet
paper-progress.sublime-snippet
paper-radio-button.sublime-snippet
paper-radio-group.sublime-snippet
paper-ripple.sublime-snippet
paper-scroll-header-panel.sublime-snippet
paper-slider.sublime-snippet
paper-spinner.sublime-snippet
paper-tab.sublime-snippet
paper-tabs.sublime-snippet
paper-toast.sublime-snippet
paper-toggle-button.sublime-snippet
paper-toolbar.sublime-snippet
paper-tooltip.sublime-snippet
polymer-behavior.sublime-snippet
polymer-element-full-strict.sublime-snippet
polymer-element-stylesheet.sublime-snippet
polymer-element.sublime-snippet
template-dom-bind.sublime-snippet
template-dom-if.sublime-snippet
template-dom-repeat.sublime-snippet
template.sublime-snippet
webcomponentsjs.sublime-snippet

README.md

Polymer Snippets for Sublime

Install

To install through Package Control, search for Polymer & Web Component Snippets. If you still don't have Package Control in Sublime Text, go get it. It's pure awesomeness.

If you don't use Package Control, you can download the package and put it manually inside your Packages directory. It should work but will not update automatically.

Elements

Type the name of any iron-* or paper-* element, then hit tab to auto complete. Ex:

Using snippets

OR, start typing the prefix for an element and hit ctrl+space to fuzzy search for a completion. Ex:

Fuzz auto complete

Polymer

[pe] polymer element

<dom-module id="$1">
	<template>
		<style>
			:host {
				display: block;
			}
		</style>
		$2
	</template>
	<script>
		Polymer({
			is: '$1'
		});
	</script>
</dom-module>

[pes] polymer element with external stylesheet

<dom-module id="$1">
	<link rel="import" type="css" href="$1.css">
	<template>
		$2
	</template>
	<script>
		Polymer({
			is: '$1'
		});
	</script>
</dom-module>

[hi] html import (I use this one a lot)

<link rel="import" href="${1:bower_components}/${0}/${0}.html">

[hii] html import iron-* element

<link rel="import" href="${1:bower_components}/iron-${2}/iron-${2}.html">

[hip] html import paper-* element

<link rel="import" href="${1:bower_components}/paper-${2}/paper-${2}.html">

Web Components

[template] template

<template$1>$0</template>

[ce] custom element

var ${4:tmpl} = document.querySelector('${5:template}');

var ${1:WidgetProto} = Object.create(HTMLElement.prototype);

${1:WidgetProto}.createdCallback = function() {
	var root = this.createShadowRoot();
	root.appendChild(document.importNode(${4:tmpl}.content, true));
};

var ${2:Widget} = document.registerElement('${3:my-widget}', {
	prototype: ${1:WidgetProto}
});

HTML

[ph] HTML template with Web Components polyfill

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">

	<title>${1}</title>
	<meta name="description" content="${2}">

	<!-- Mobile -->
	<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">

	<!-- Chrome / Android -->
	<meta name="mobile-web-app-capable" content="yes">
	<meta name="theme-color" content="black">
	<link rel="icon" href="icon.png">

	<!-- Safari / iOS -->
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<link rel="apple-touch-icon-precomposed" href="apple-touch-icon.png">

	<!-- Web Components -->
	<script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>
</head>
<body unresolved>
	$0
</body>
</html>

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -m 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

MIT License © Rob Dodson