Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I build Polymer Element?

There is currently an open bug on running polymer build on elements: https://github.com/Polymer/polymer-cli/issues/338

Does anyone have some Grunt scripts (or description of what exactly it does) for accomplishing the same?

like image 460
Svante Avatar asked Sep 02 '16 13:09

Svante


People also ask

What is Polymer build?

The Polymer build tools ensure that your applications can run across multiple and older browsers. Polymer 2.0 is written in ES6, for more legible, maintainable, and modular code. For compatibility with older browsers, the Polymer build tools must compile ES6 to ES5.

What is a Polymer element?

Polymer elements are a set of visual and non-visual elements designed to work with the layout, user interaction, selection, and scaffolding applications. These include everything from a simple button to a dialog box with neat visual effects.

Does Polymer help in creating custom elements?

Polymer adds a set of features to the basic custom element: Instance methods to handle common tasks. Automation for handling properties and attributes, such as setting a property based on the corresponding attribute. Creating shadow DOM trees for element instances based on a supplied template.


2 Answers

The problem is on the element default imports. The tree of the directorie should be:

element/
  bower_components/
  build/
  demo/
  teste/
  bower.json
  element-test.html
  index.html
  READEME.md

The imports on index.html and elemt-test.html are calling for "../dependency", but the correct is to call "bower_components/dependency", it will work if you just fix the paths.

like image 50
MarioAleo Avatar answered Oct 02 '22 15:10

MarioAleo


I ended up using the Yeoman generator from: https://github.com/seaneking/generator-polymer-element

It has a very nice list of features set up in the Gulp build system. The build system includes Babel ES6 transpiling, Rollup, PostCSS, inline asset processing, and BrowserSync.

like image 42
Svante Avatar answered Oct 02 '22 17:10

Svante