Skip to content

Polymer application using Hacker News public API with firebase.

License

Notifications You must be signed in to change notification settings

nemanja-popovic/polymer-hacker-news

Repository files navigation

Polymer Hacker News

A simple Hacker News implementation using Polymer 1.0 based on Polymer Starter Kit

Demo

Demo can be found here: https://hn-polymer.firebaseapp.com/

Hacker News API

More details about Hacker News API can be found here: https://github.com/HackerNews/API

Contributions

Contributions are more than welcome.

Install dependencies

Quick-start (for experienced users)

With Node.js installed, run the following one liner from the root of Polymer Hacker News:

npm install -g gulp bower && npm install && bower install

Prerequisites (for everyone)

The app requires the following major dependencies:

  • Node.js, used to run JavaScript tools from the command line.
  • npm, the node package manager, installed with Node.js and used to install Node.js packages.
  • gulp, a Node.js-based build tool.
  • bower, a Node.js-based package manager used to install front-end packages (like Polymer).

To install dependencies:

  1. Check your Node.js version.
node --version

The version should be at or above 0.12.x.

  1. If you don't have Node.js installed, or you have a lower version, go to nodejs.org and click on the big green Install button.

  2. Install gulp and bower globally.

npm install -g gulp bower

This lets you run gulp and bower from the command line.

  1. Install the app's local npm and bower dependencies.
npm install && bower install

This installs the element sets (Paper, Iron, Platinum) and tools the starter kit requires to build and serve apps.

Development workflow

Serve / watch

gulp serve

This outputs an IP address you can use to locally test and another that can be used on devices connected to your network.

Run tests

gulp test:local

This runs the unit tests defined in the app/test directory through web-component-tester.

To run tests Java 7 or higher is required. To update Java go to http://www.oracle.com/technetwork/java/javase/downloads/index.html and download JDK and install it.

Build & Vulcanize

gulp

Build and optimize the current project, ready for deployment. This includes vulcanization, image, script, stylesheet and HTML optimization and minification.

Application Theming & Styling

Polymer 1.0 introduces a shim for CSS custom properties. We take advantage of this in app/styles/app-theme.html to provide theming for your application. You can also find our presets for Material Design breakpoints in this file.

Read more about CSS custom properties.

Styling

  1. main.css - to define styles that can be applied outside of Polymer's custom CSS properties implementation. Some of the use-cases include defining styles that you want to be applied for a splash screen, styles for your application 'shell' before it gets upgraded using Polymer or critical style blocks that you want parsed before your elements are.
  2. app-theme.html - to provide theming for your application. You can also find our presets for Material Design breakpoints in this file.
  3. shared-styles.html - to share styles between elements and index.html.
  4. element styles only - styles specific to element. These styles should be inside the <style></style> inside template.
<dom-module id="my-list">
  <template>
    <style>
      :host {
        display: block;
        background-color: yellow;
      }
    </style>
    <ul>
      <template is="dom-repeat" items="{{items}}">
        <li><span class="paper-font-body1">{{item}}</span></li>
      </template>
    </ul>
  </template>
</dom-module>

These style files are located in the styles folder.

Unit Testing

Web apps built with Polymer Starter Kit come configured with support for Web Component Tester - Polymer's preferred tool for authoring and running unit tests. This makes testing your element based applications a pleasant experience.

Read more about using Web Component tester.

Dependency Management

Polymer uses Bower for package management. This makes it easy to keep your elements up to date and versioned. For tooling, we use npm to manage Node.js-based dependencies.

Components installed by Bower live in the app/bower_components directory. This location is specified by the .bowerrc file. Many projects which follow Yeoman conventions place the bower_components directory outside of the app directory and then mount it using a server. This causes problems for tools like Vulcanize and web-component-shards which rely on relative paths. We've chosen to simplify things and have bower_components live inside of app to resolve these issues.

Deploy

Github Pages

  1. Uncomment this line // app.baseUrl = '/polymer-starter-kit/'; in app.js near the top
  2. Change app.baseUrl = '/polymer-starter-kit/'; to app.baseUrl = '/your-pathname/'; (ex: if you repo is github.com/username/bobs-awesome-site you would change this to bobs-awesome-site)
  3. Run gulp build-deploy-gh-pages from command line
  4. To see changes wait 1-2 minutes then load Github pages for your app (ex: https://polymerelements.github.io/polymer-starter-kit/)

See more details

Firebase

See detail recipe

About

Polymer application using Hacker News public API with firebase.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published