ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Polymer & Web Component Snippets

by robdodson ALL

Sublime snippets for Polymer and Web Components

Labels snippets

Details

  • 2017.01.24.20.01.54
  • github.​com
  • github.​com
  • 8 years ago
  • 2 hours ago
  • 11 years ago

Installs

  • Total 12K
  • Win 5K
  • Mac 4K
  • Linux 2K
Jun 3 Jun 2 Jun 1 May 31 May 30 May 29 May 28 May 27 May 26 May 25 May 24 May 23 May 22 May 21 May 20 May 19 May 18 May 17 May 16 May 15 May 14 May 13 May 12 May 11 May 10 May 9 May 8 May 7 May 6 May 5 May 4 May 3 May 2 May 1 Apr 30 Apr 29 Apr 28 Apr 27 Apr 26 Apr 25 Apr 24 Apr 23 Apr 22 Apr 21 Apr 20
Windows 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
Mac 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
01234Jun 3May 31May 28May 25May 22May 19May 16May 13May 10May 7May 4May 1Apr 28Apr 25Apr 22Jun 3 Linux: 0 Mac: 0 Windows: 0Jun 2 Linux: 0 Mac: 0 Windows: 0Jun 1 Linux: 0 Mac: 0 Windows: 0May 31 Linux: 0 Mac: 0 Windows: 0May 30 Linux: 0 Mac: 0 Windows: 0May 29 Linux: 0 Mac: 0 Windows: 0May 28 Linux: 0 Mac: 0 Windows: 0May 27 Linux: 0 Mac: 0 Windows: 0May 26 Linux: 0 Mac: 0 Windows: 0May 25 Linux: 0 Mac: 0 Windows: 0May 24 Linux: 0 Mac: 0 Windows: 0May 23 Linux: 0 Mac: 0 Windows: 0May 22 Linux: 0 Mac: 0 Windows: 0May 21 Linux: 0 Mac: 0 Windows: 0May 20 Linux: 0 Mac: 0 Windows: 0May 19 Linux: 0 Mac: 0 Windows: 0May 18 Linux: 0 Mac: 0 Windows: 0May 17 Linux: 0 Mac: 0 Windows: 0May 16 Linux: 0 Mac: 0 Windows: 0May 15 Linux: 0 Mac: 0 Windows: 0May 14 Linux: 0 Mac: 0 Windows: 0May 13 Linux: 0 Mac: 0 Windows: 0May 12 Linux: 0 Mac: 0 Windows: 0May 11 Linux: 0 Mac: 0 Windows: 0May 10 Linux: 0 Mac: 0 Windows: 0May 9 Linux: 0 Mac: 0 Windows: 0May 8 Linux: 0 Mac: 0 Windows: 0May 7 Linux: 0 Mac: 0 Windows: 0May 6 Linux: 0 Mac: 0 Windows: 0May 5 Linux: 0 Mac: 0 Windows: 0May 4 Linux: 0 Mac: 0 Windows: 0May 3 Linux: 0 Mac: 0 Windows: 0May 2 Linux: 0 Mac: 0 Windows: 0May 1 Linux: 0 Mac: 0 Windows: 0Apr 30 Linux: 0 Mac: 0 Windows: 1Apr 29 Linux: 0 Mac: 0 Windows: 0Apr 28 Linux: 0 Mac: 0 Windows: 0Apr 27 Linux: 0 Mac: 0 Windows: 0Apr 26 Linux: 0 Mac: 0 Windows: 0Apr 25 Linux: 0 Mac: 0 Windows: 0Apr 24 Linux: 0 Mac: 0 Windows: 0Apr 23 Linux: 0 Mac: 0 Windows: 0Apr 22 Linux: 0 Mac: 0 Windows: 0Apr 21 Linux: 0 Mac: 0 Windows: 0Apr 20 Linux: 0 Mac: 0 Windows: 0Jun 3 Linux: 0 Mac: 0 Windows: 0Jun 2 Linux: 0 Mac: 0 Windows: 0Jun 1 Linux: 0 Mac: 0 Windows: 0May 31 Linux: 0 Mac: 0 Windows: 0May 30 Linux: 0 Mac: 0 Windows: 0May 29 Linux: 0 Mac: 0 Windows: 0May 28 Linux: 0 Mac: 0 Windows: 0May 27 Linux: 0 Mac: 0 Windows: 0May 26 Linux: 0 Mac: 0 Windows: 0May 25 Linux: 0 Mac: 0 Windows: 0May 24 Linux: 0 Mac: 0 Windows: 0May 23 Linux: 0 Mac: 0 Windows: 0May 22 Linux: 0 Mac: 0 Windows: 0May 21 Linux: 0 Mac: 0 Windows: 0May 20 Linux: 0 Mac: 0 Windows: 0May 19 Linux: 0 Mac: 0 Windows: 0May 18 Linux: 0 Mac: 0 Windows: 0May 17 Linux: 0 Mac: 0 Windows: 0May 16 Linux: 0 Mac: 0 Windows: 0May 15 Linux: 0 Mac: 0 Windows: 0May 14 Linux: 0 Mac: 0 Windows: 0May 13 Linux: 0 Mac: 0 Windows: 0May 12 Linux: 0 Mac: 0 Windows: 0May 11 Linux: 0 Mac: 0 Windows: 0May 10 Linux: 0 Mac: 0 Windows: 0May 9 Linux: 0 Mac: 0 Windows: 0May 8 Linux: 0 Mac: 0 Windows: 0May 7 Linux: 0 Mac: 0 Windows: 0May 6 Linux: 0 Mac: 0 Windows: 0May 5 Linux: 0 Mac: 0 Windows: 0May 4 Linux: 0 Mac: 0 Windows: 0May 3 Linux: 0 Mac: 0 Windows: 0May 2 Linux: 0 Mac: 0 Windows: 0May 1 Linux: 0 Mac: 0 Windows: 0Apr 30 Linux: 0 Mac: 0 Windows: 1Apr 29 Linux: 0 Mac: 0 Windows: 0Apr 28 Linux: 0 Mac: 0 Windows: 0Apr 27 Linux: 0 Mac: 0 Windows: 0Apr 26 Linux: 0 Mac: 0 Windows: 0Apr 25 Linux: 0 Mac: 0 Windows: 0Apr 24 Linux: 0 Mac: 0 Windows: 0Apr 23 Linux: 0 Mac: 0 Windows: 0Apr 22 Linux: 0 Mac: 0 Windows: 0Apr 21 Linux: 0 Mac: 0 Windows: 0Apr 20 Linux: 0 Mac: 0 Windows: 0Jun 3 Linux: 0 Mac: 0 Windows: 0Jun 2 Linux: 0 Mac: 0 Windows: 0Jun 1 Linux: 0 Mac: 0 Windows: 0May 31 Linux: 0 Mac: 0 Windows: 0May 30 Linux: 0 Mac: 0 Windows: 0May 29 Linux: 0 Mac: 0 Windows: 0May 28 Linux: 0 Mac: 0 Windows: 0May 27 Linux: 0 Mac: 0 Windows: 0May 26 Linux: 0 Mac: 0 Windows: 0May 25 Linux: 0 Mac: 0 Windows: 0May 24 Linux: 0 Mac: 0 Windows: 0May 23 Linux: 0 Mac: 0 Windows: 0May 22 Linux: 0 Mac: 0 Windows: 0May 21 Linux: 0 Mac: 0 Windows: 0May 20 Linux: 0 Mac: 0 Windows: 0May 19 Linux: 0 Mac: 0 Windows: 0May 18 Linux: 0 Mac: 0 Windows: 0May 17 Linux: 0 Mac: 0 Windows: 0May 16 Linux: 0 Mac: 0 Windows: 0May 15 Linux: 0 Mac: 0 Windows: 0May 14 Linux: 0 Mac: 0 Windows: 0May 13 Linux: 0 Mac: 0 Windows: 0May 12 Linux: 0 Mac: 0 Windows: 0May 11 Linux: 0 Mac: 0 Windows: 0May 10 Linux: 0 Mac: 0 Windows: 0May 9 Linux: 0 Mac: 0 Windows: 0May 8 Linux: 0 Mac: 0 Windows: 0May 7 Linux: 0 Mac: 0 Windows: 0May 6 Linux: 0 Mac: 0 Windows: 0May 5 Linux: 0 Mac: 0 Windows: 0May 4 Linux: 0 Mac: 0 Windows: 0May 3 Linux: 0 Mac: 0 Windows: 0May 2 Linux: 0 Mac: 0 Windows: 0May 1 Linux: 0 Mac: 0 Windows: 0Apr 30 Linux: 0 Mac: 0 Windows: 1Apr 29 Linux: 0 Mac: 0 Windows: 0Apr 28 Linux: 0 Mac: 0 Windows: 0Apr 27 Linux: 0 Mac: 0 Windows: 0Apr 26 Linux: 0 Mac: 0 Windows: 0Apr 25 Linux: 0 Mac: 0 Windows: 0Apr 24 Linux: 0 Mac: 0 Windows: 0Apr 23 Linux: 0 Mac: 0 Windows: 0Apr 22 Linux: 0 Mac: 0 Windows: 0Apr 21 Linux: 0 Mac: 0 Windows: 0Apr 20 Linux: 0 Mac: 0 Windows: 0

Readme

Source
raw.​githubusercontent.​com

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}">


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


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


    <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">


    <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