Skip to content

Commit

Permalink
Merge branch 'master' into 2.0-preview-with-prpl-server
Browse files Browse the repository at this point in the history
  • Loading branch information
keanulee committed Oct 2, 2017
2 parents a241764 + fe5b4cc commit a6a9756
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 61 deletions.
20 changes: 4 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,22 @@ Install [polymer-cli](https://github.com/Polymer/polymer-cli):

npm install -g polymer-cli

### Google App Engine SDK

Install [Google App Engine SDK](https://cloud.google.com/appengine/downloads)

## Setup
### Setup

git clone https://github.com/polymer/news.git
cd news
bower install

## Start the development server

dev_appserver.py .
polymer serve

## Build

polymer build

## Test the build

This command serves the `es5-bundled` build version of the app:

dev_appserver.py build/es5-bundled

This command serves the `es6-unbundled` build version of the app:

dev_appserver.py build/es6-unbundled

## Deploy to Google App Engine
Use `polymer serve` to serve a specific build preset of the app. For example:

gcloud app deploy build/es6-unbundled/app.yaml --project [YOUR_PROJECT_ID]
polymer serve build/es5-bundled
4 changes: 3 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@
<html lang="en">
<head>
<meta charset="utf-8">
<base href="/">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">

<title>NEWS</title>

<link rel="shortcut icon" sizes="32x32" href="images/news-icon-32.png">
<meta name="theme-color" content="#000">
<link rel="manifest" href="manifest.json">
<base href="/">

<style>

body {
Expand Down Expand Up @@ -69,6 +70,7 @@
<body>

<news-app unresolved app-title="NEWS">NEWS</news-app>

<script src="bower_components/webcomponentsjs/webcomponents-loader.js"></script>
<link rel="import" href="src/news-app.html">

Expand Down
31 changes: 0 additions & 31 deletions main.py

This file was deleted.

5 changes: 1 addition & 4 deletions polymer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@
"sources": [
"src/**/*",
"images/**/*",
"data/**/*",
"bower.json"
"data/**/*"
],
"extraDependencies": [
"app.yaml",
"main.py",
"manifest.json",
"bower_components/webcomponentsjs/*"
],
Expand Down
2 changes: 1 addition & 1 deletion src/news-app.html
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@

// Load pre-caching Service Worker
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('service-worker.js');
navigator.serviceWorker.register('service-worker.js', {scope: '/'});
}
});
});
Expand Down
10 changes: 5 additions & 5 deletions src/news-article.html
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,8 @@

// Is touchmove mostly horizontal or vertical?
if (!this._touchDir) {
let absX = Math.abs(event.changedTouches[0].clientX - this._startX);
let absY = Math.abs(event.changedTouches[0].clientY - this._startY);
const absX = Math.abs(event.changedTouches[0].clientX - this._startX);
const absY = Math.abs(event.changedTouches[0].clientY - this._startY);
this._touchDir = absX > absY ? 'x' : 'y';
}

Expand Down Expand Up @@ -387,7 +387,7 @@
}

_swapCurrentArticleCovers(newCover) {
let oldCover = this._currentArticleCover;
const oldCover = this._currentArticleCover;
oldCover.classList.remove('fade-in');
oldCover.classList.add('preview-cover');

Expand Down Expand Up @@ -437,14 +437,14 @@

_computePreviousArticle(categoryItems, article) {
if (categoryItems) {
let i = categoryItems.indexOf(article);
const i = categoryItems.indexOf(article);
return i > 0 ? categoryItems[i-1] : null;
}
}

_computeNextArticle(categoryItems, article) {
if (categoryItems) {
let i = categoryItems.indexOf(article);
const i = categoryItems.indexOf(article);
return (i > -1 && i < categoryItems.length-1) ? categoryItems[i+1] : null;
}
}
Expand Down
15 changes: 12 additions & 3 deletions sw-precache-config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
module.exports = {
staticFileGlobs: [
'/manifest.json',
'/bower_components/webcomponentsjs/*.js',
'/images/*'
'manifest.json',
'bower_components/webcomponentsjs/webcomponents-loader.js',
'images/*'
],
runtimeCaching: [
{
urlPattern: /\/bower_components\/webcomponentsjs\/.*.js/,
handler: 'fastest',
options: {
cache: {
name: 'webcomponentsjs-polyfills-cache'
}
}
},
{
urlPattern: /.*\.(png|jpg|gif|svg)/i,
handler: 'fastest',
Expand Down

0 comments on commit a6a9756

Please sign in to comment.