Code Monkey home page Code Monkey logo

seed-element's Introduction

seed-element

An element providing a starting point for your own reusable Polymer elements.

Dependencies

Element dependencies are managed via Bower. You can install that via:

npm install -g bower

Then, go ahead and download the element's dependencies:

bower install

Linting Your Element

If you wish to lint your element, we recommend that you use Polylint to take into account Polymer linting specificities. You can install it via:

npm install -g polylint

And you can run it via:

polylint -i seed-element.html

If your element contains errors, they will appear on the console.

Note that it is possible to use Polylint with Atom and Sublime with the appropriate package/plugin.

For more options regarding polylint, please refer to the documentation.

Playing With Your Element

If you wish to work on your element in isolation, we recommend that you use Polyserve to keep your element's bower dependencies in line. You can install it via:

npm install -g polyserve

And you can run it via:

polyserve

Once running, you can preview your element at http://localhost:8080/components/seed-element/, where seed-element is the name of the directory containing it.

Testing Your Element

Simply navigate to the /test directory of your element to run its tests. If you are using Polyserve: http://localhost:8080/components/seed-element/test/

web-component-tester

The tests are compatible with web-component-tester. Install it via:

npm install -g web-component-tester

Then, you can run your tests on all of your local browsers via:

wct

WCT Tips

wct -l chrome will only run tests in chrome.

wct -p will keep the browsers alive after test runs (refresh to re-run).

wct test/some-file.html will test only the files you specify.

Yeoman support

If you'd like to use Yeoman to scaffold your element that's possible. The official generator-polymer generator has a seed subgenerator.

seed-element's People

Contributors

abdonrd avatar addyosmani avatar alexpaluzzi avatar arthurvr avatar dfreedm avatar ebidel avatar florianv avatar hemanth avatar ktiedt avatar leitzler avatar mco-gh avatar metanov avatar mikaelharsjo avatar nevir avatar nishacodes avatar raggi avatar ragingwind avatar rictic avatar robdodson avatar samccone avatar tedium-bot avatar tjsavage avatar yufengg 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

seed-element's Issues

Best practices for reusable component development.

Hi,

First of all, thank you very much for this seed. It is wonderful and very useful.

I am new with polymer and I am trying to setup a good environment to develop a web app.
Firstly, I want to develop a reusable login-form component. It will depend on paper-material, paper-input and paper-button elements. I used this seed to create it.

Very quickly, I have noticed that developing in this seed-element project was not easy. There are no files watchers for polyserve reloading and no watchers to trigger wct tests (I hope a watch mode will be added to wct soon: Polymer/web-component-tester#32).

What is the best practice to develop a reusable component ? Should I include a git submodule directly in my webapp and use the webapp files watchers ? Should we add a watcher mode into polyserve ? Anything else ?

Thanks in advance.

Integration of transpilable DSL within seed-element dev workflow

I've been asking this question several times on slack @Polymer without an answer, maybe the maintainers of PSE have informations.

What would be the recommended way to use DSL (Eg Jade, HAML, Coffee etc), and even ES2015 within a seed-element based repository, allowing Polyserve to correctly run, while publishing the correct transpiled files when other people use the element? Would that require the integration of a proper Gulpfile? Or is there anything already recommended regarding that?

Test the composed dom of <seed-element>

The current <seed-element> example tests don't show how to assert that the composed dom is as expected. They show how to test the API, but custom elements are about appearance as much as they're about APIs.

Remove license text from the files

I am using the seed for create some components, right now I am not comfortable with that text there all the time. Is there any possibility of removed from the seed? It's fine for me if you put it inside LICENSE but not inside every single file and inside of some production code

Best practice dir structure for dependencies?

The method here seems fragile and intrusive (installing all deps in the parent of the dev directory). Are there any ideas for a better practice?

I know it's common to have all dependencies as siblings to the component directory and that adds a layer of difficulty when you have to rely on relative paths for inclusion.

What about something like the following directory structure?

my-element
|-- sandbox
|    |-- src
|         |-- my-element.html
+-- .bowerrc
+-- bower.json

With the dependency installation occurring in the sandbox/ dir (only an example) so that dependencies look like this after installation

my-element
|-- sandbox
|    |-- src
|    |    |-- my-element.html
|    +-- polymer
|    |    |-- polymer.html
|    +-- platform
|         |-- platform.js
+-- .bowerrc
+-- bower.json

The built component (assuming a build process that optimizes and compresses) could then be located at the root of the directory to accommodate the same pattern of accessing deps via the relative sibling directory in a consuming project.

A checkout with the built component would look like this.

my-element
|-- sandbox
|    |-- src
|    |    |-- my-element.html
+-- .bowerrc
+-- bower.json
+-- my-element.html

I'm not saying this is the best solution, just opening the topic for discussion.

/cc @addyosmani @robdodson @jstrimpel

Unit test with wct error

Hi,

I think the unit test should be upgrade. I have this errors :

$ wct
Starting Selenium server for local browsers
Selenium server running on port 48531
Web server running on port 52922 and serving from /home/ystreibel/projects/Polymer
404 GET /webcomponentsjs/webcomponents-lite.js
chrome 42                Beginning tests via http://localhost:52922/seed-element/test/index.html?cli_browser_id=0
404 GET /webcomponentsjs/webcomponents-lite.js
404 GET /polymer/polymer.html
chrome 42                ✖ basic-test.html » <seed-element> » defines the "author" property

  Cannot read property 'name' of undefined
    <unknown> at   Context.<anonymous> at /seed-element/test/basic-test.html:33:0

chrome 42                ✖ basic-test.html » <seed-element> » says hello

  myEl.sayHello is not a function
    <unknown> at   Context.<anonymous> at /seed-element/test/basic-test.html:38:0

chrome 42                ✖ basic-test.html » <seed-element> » fires lasers

  myEl.fireLasers is not a function
    <unknown> at   Context.<anonymous> at /seed-element/test/basic-test.html:49:0

chrome 42                Tests failed: 3 failed tests
404 GET /webcomponentsjs/webcomponents-lite.js
firefox 37               Beginning tests via http://localhost:52922/seed-element/test/index.html?cli_browser_id=1
404 GET /webcomponentsjs/webcomponents-lite.js
firefox 37               ✖ basic-test.html » <seed-element> » defines the "author" property

  myEl.author is undefined
    <unknown> at   <unknown> at /seed-element/test/basic-test.html:33:0

firefox 37               ✖ basic-test.html » <seed-element> » says hello

  myEl.sayHello is not a function
    <unknown> at   <unknown> at /seed-element/test/basic-test.html:38:0

firefox 37               ✖ basic-test.html » <seed-element> » fires lasers

  myEl.fireLasers is not a function
    <unknown> at   <unknown> at /seed-element/test/basic-test.html:49:0

firefox 37               Tests failed: 3 failed tests
Test run ended in failure: 3 failed tests

chrome 42 (0/0/3)                       firefox 37 (0/0/3)                    



┌────────────────────────────────────────────────────┐
│ Update available: 3.1.3 (current: 2.2.6)           │
│ Run npm install -g web-component-tester to update. │
└────────────────────────────────────────────────────┘


3 failed tests

Having dependencies just for the demo?

What is the correct way to have extra dependencies for the demo file? For my element itself, I don't need voice-elements but for the demo I do. Currently, I have it as a dependency no matter what.

Publish to private bower and Github enterprise?

Is there anyway to publish to a private bower registry and Github Enterprise pages instead of the public ones? Is there a project you recomend for hosting private docs and modules for polymer? I saw el.io but not sure if there is a better one. Thanks.

Unclear how to test multiple events in same suite

I've found myself wanting to write a test suite that contains multiple tests for asynchronous events. The sample test suite illustrates how to test that a single event is fired, with done() called as part of the event handler, terminating the test suite.

It's not clear what the best practice is for ensuring that multiple event handlers are invoked before terminating the test suite. Poking around a bit I've found, e.g., chai-as-promised, or maybe this is something that either Mocha or Chai supports natively.

It would be great if someone more comfortable with testing best practices could modify the example test suite to provide an example of testing that multiple events have been fired.

Initial layout broken by some component referenced.

How to reproduce: Download any zip, (I tried 1.0.0 and 1.0.6), unzip, bower install, polyserve.
The 'Docs' and 'Demo' buttons are no longer in the top right arranged horizontally, they are now behind the <iron-doc-viewer>.
This problem appeared sometime in the last 3 hours. Before that everything was ok in this regard.

Build process?

Would it be useful to have a simple grunt/gulp file to server the files for testing the element locally ?

Rename to seed-element

Per a discussion with @robdodson, if this is going to be the canonical element we suggest developers build from would it be sensible to rename it something clearer like seed-element?.

Linting seed-element

Using polylint on the index.html brings the following errors:

../iron-doc-viewer/iron-doc-viewer.html:67:5
    Property '_properties' bound to attribute 'hidden$' not found in 'properties' for element 'iron-doc-viewer'
../iron-doc-viewer/iron-doc-viewer.html:69:7
    Property '_properties' bound to attribute 'items' not found in 'properties' for element 'iron-doc-viewer'
../iron-doc-viewer/iron-doc-viewer.html:69:7
    Property '_properties' bound to attribute 'hidden$' not found in 'properties' for element 'iron-doc-viewer'
../iron-doc-viewer/iron-doc-viewer.html:74:5
    Property '_methods' bound to attribute 'hidden$' not found in 'properties' for element 'iron-doc-viewer'
../iron-doc-viewer/iron-doc-viewer.html:76:7
    Property '_methods' bound to attribute 'items' not found in 'properties' for element 'iron-doc-viewer'
../iron-doc-viewer/iron-doc-viewer.html:81:5
    Property '_events' bound to attribute 'hidden$' not found in 'properties' for element 'iron-doc-viewer'
../iron-doc-viewer/iron-doc-viewer.html:83:7
    Property '_events' bound to attribute 'items' not found in 'properties' for element 'iron-doc-viewer'
../iron-doc-viewer/iron-doc-viewer.html:88:5
    Property '_behaviors' bound to attribute 'hidden$' not found in 'properties' for element 'iron-doc-viewer'
../iron-doc-viewer/iron-doc-viewer.html:90:7
    Property '_behaviors' bound to attribute 'items' not found in 'properties' for element 'iron-doc-viewer'
../iron-ajax/iron-ajax.html:38:1
    Property UNKNOWN not found in 'properties' for element 'iron-ajax'
../iron-doc-viewer/iron-doc-property.html:34:9
    Property 'return' bound to attribute 'hidden$' not found in 'properties' for element 'iron-doc-property'
../iron-doc-viewer/iron-doc-property.html:26:82
    Property _paramText not found in 'properties' for element 'iron-doc-property'
../paper-ripple/paper-ripple.html:163:1
    Property isAttached not found in 'properties' for element 'paper-ripple'

Brief questions

Hey Scott. Thanks for putting this together! I had a few quick questions whenever time allows:

  • Does this boilerplate use the script your previously mentioned for publishing a deployment (gh-pages) branch from master? If so, is it worth sharing that or including a sample of it somewhere visible?
  • Bower.json currently targets Polymer master rather than locking in to a specific version. This appears to be how Polymer eng prefer to develop their own elements. Will we be suggesting other devs do the same?

Adding a section "Linting your element"

Hi,
I think it would be worth to add a small section explaining how to use polylint to lint your element even before trying to use polyserve, e.g. calling polylint -i seed-element.html in the element directory.

Mocha setup currently broken

Out of the box, if a user runs bower install the current unit testing setup doesn't run correctly when you navigate to tests in the test directory. I'll get this fixed.

Consider adding gulp file

I'd like to see a gulpfile added to the seed element which featured some of the following.

gulp demo - Opens iron-component-page to the demos.
gulp docs - Opens iron-component-page to the docs.
gulp test - Runs wct
gulp vulcanize - Flattens the element and all it's dependencies into .dist directory.
gulp build - Runs Polybuild
gulp lint - Lints the element.
gulp weight - Opens chrome to a polydev report
gulp serve - polyserve

@return annotations don't generate any docs

See, e.g. the @return statement in sayHello's comment block -- no corresponding text in the generated doc.

In general, it would be great to have clearer documentation around which JSDoc annotations are supported, and if there are any restrictions (e.g. @param annotations may not be multiple lines.)

Why my demo page and default value of properties isn't show?

my project is in github.com/large-screen-only/large-screen-only, and it runs on large-screen-only.github.io

I simply put a div inside my demo page, but it doesn't shown. the src in iframe i saw in devtool is still about:blank. i've already added @demo demo/index.html inside the element.

the default value of properties also can't be shown and i don't know why.

Please help me.

.bowerrc's ../ is dangerous

We're potentially blowing up a user's environment when they naively do a git clone followed by bower install.

gulpfile issues

It's not clear why gulpfile is here because basically we can't do anything with it. Firstly, package.json file with dependencies is missing. Secondly, after installing gulp and web-component-tester as dependencies, running gulp is failing due to initGulp method. Changing the line to the following starts working:

require('web-component-tester').gulp.init(gulp);

However, the question is why do we need the gulpfile there on the first place?

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.