Git Product home page Git Product logo

polymersnippets's Introduction

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

polymersnippets's People

Contributors

benhjt avatar bpinney avatar danprime avatar diegohaz avatar francoischalifour avatar gabrieldu avatar gabrielduque avatar jsilvermist avatar loveandhappiness avatar mbtamuli avatar metanov avatar redbassett avatar robdodson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

polymersnippets's Issues

Indentation

Is it possible to make the snippets match current indentation? I am using 4-space tabs (tabs rather than spaces) in my HTML documents, however the snippet for paper-header-panel (for example) has it's content indented with two spaces instead.

Update to Polymer 2

Hi!
Is there any possibilities that update the plugin to Polymer 2?
Greetings

paper-card

Please create a snippet for the paper-card element.

Updates for 1.0?

There's no rush (I just discovered these snippets!), but I would love to see these updated for 1.0 whenever you've got some time Rob. I'll try forking it and doing it myself with all the new elements when I've got some time myself.

You the man Dodson.

Polymer 2.0 Snippets?

Since 2.0 element definitions are so different, the new format should get snippets as well.

Brother!! I asked the trouble: the polymer is not complete, and do not need to install, decompression to the server environment can run the compression package? Thank you very much!!

EN

I asked the question: the polymer is not complete, do not need to install, unzip to the server environment can run compressed package? If the documentation, I 3 days all translated into Chinese, thanks!!

Note: on China ban Google, Google and open source libraries such as fonts, for example: https://cdn.c2cmalls.com/material-design-icons/icons/

Https://design.google.com/icons/

CN

大哥我问的问题是:聚合物是不是完全的,不需要安装,解压到服务器环境下可以运行压缩包吗?如果含说明文档,我3天内全部翻译成中文,拜谢!!
备注:关于**禁谷歌的问题,开源库及谷歌字体等,已经解决!例:https://cdn.c2cmalls.com/material-design-icons/icons/

https://design.google.com/icons/
应该是聚合物框架

Behavior Snippet

Please think about adding a behavior snippet to the collection.

How to edit the snippets?

Hi Rob, nice job on the Polymer Snippets! I am new to Sublime and Mac, is there an easy way to edit the snippets? For example, using "Yo Polymer", then the "hi" snippet, I have to add the "../" in front of "bower-components". It would be nice to edit these small changes.

Polymer 3 preview with Typescript issue on my sample project

Hi Rob,

I know this is not the right repository for raising this issue, however, I do not have any other means of asking a quick question on something I am currently having issue with.

I am trying to use Polymer 3 Preview, with Typescript and facing issues with supporting the application on Internet Explorer 11.

below is the repository with simplest code that works on Chrome but fails on Internet explorer.

https://github.com/hitesh97/polymer3-typescript-ie11

I see that you are one of the foremost polymer advocate and would be able to point me to the right direction.

Cheers.
Hitesh.

Casing has changed for all attributes

Example

<iron-media-query query="min-width: 640px" queryMatches="{{largeScreen}}">
</iron-media-query>

is now

<iron-media-query query="min-width: 640px" query-matches="{{largeScreen}}">
</iron-media-query>

Not realising this made me struggle for close to an hour..

Template snippets

It would be useful to have template snippets for dom-bind, dom-repeat, etc.

Comment block to pe snippet

It would be useful if there were a comment block added to the pe snippet with the appropriate annotations. This would prompt people to comment their code.

comment blocks wrong language?

The comment blocks for the polymer element variations looks incorrect to me. These are javascript block comments in an html section of the module. I think these should either be:

  1. removed
  2. converted to HTML comment syntax
    or
  3. moved to the Javascript section

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.