-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
864 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# EditorConfig helps developers define and maintain consistent | ||
# coding styles between different editors and IDEs | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
|
||
[*] | ||
|
||
# Change these settings to your own preference | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
# We recommend you to keep these unchanged | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
bower_components | ||
dist | ||
node_modules | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# Polymer App Toolbox - Drawer Template | ||
|
||
This template is a starting point for building apps using a drawer-based | ||
layout. The layout is provided by `app-layout` elements. | ||
|
||
This template, along with the `polymer-cli` toolchain, also demonstrates use | ||
of the "PRPL pattern" This pattern allows fast first delivery and interaction with | ||
the content at the initial route requested by the user, along with fast subsequent | ||
navigation by pre-caching the remaining components required by the app and | ||
progressively loading them on-demand as the user navigates through the app. | ||
|
||
The PRPL pattern, in a nutshell: | ||
|
||
* **Push** components required for the initial route | ||
* **Render** initial route ASAP | ||
* **Pre-cache** components for remaining routes | ||
* **Lazy-load** and progressively upgrade next routes on-demand | ||
|
||
### Setup | ||
|
||
##### Prerequisites | ||
|
||
Install [polymer-cli](https://github.com/Polymer/polymer-cli): | ||
|
||
npm install -g polymer-cli | ||
|
||
##### Initialize project from template | ||
|
||
mkdir my-app | ||
cd my-app | ||
polymer init app-drawer-template | ||
|
||
### Start the development server | ||
|
||
This command serves the app at `http://localhost:8080` and provides basic URL | ||
routing for the app: | ||
|
||
polymer serve | ||
|
||
|
||
### Build | ||
|
||
This command performs HTML, CSS, and JS minification on the application | ||
dependencies, and generates a service-worker.js file with code to pre-cache the | ||
dependencies based on the entrypoint and fragments specified in `polymer.json`. | ||
The minified files are output to the `build/unbundled` folder, and are suitable | ||
for serving from a HTTP/2+Push compatible server. | ||
|
||
In addition the command also creates a fallback `build/bundled` folder, | ||
generated using fragment bundling, suitable for serving from non | ||
H2/push-compatible servers or to clients that do not support H2/Push. | ||
|
||
polymer build | ||
|
||
### Test the build | ||
|
||
This command serves the minified version of the app in an unbundled state, as it would | ||
be served by a push-compatible server: | ||
|
||
polymer serve build/unbundled | ||
|
||
This command serves the minified version of the app generated using fragment bundling: | ||
|
||
polymer serve build/bundled | ||
|
||
### Extend | ||
|
||
You can extend the app by adding more elements that will be demand-loaded | ||
e.g. based on the route, or to progressively render non-critical sections | ||
of the application. Each new demand-loaded fragment should be added to the | ||
list of `fragments` in the included `polymer.json` file. This will ensure | ||
those components and their dependencies are added to the list of pre-cached | ||
components (and will have bundles created in the fallback `bundled` build). | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "akirodic.com", | ||
"authors": [ | ||
"Aki Rodic", | ||
"The Polymer Authors" | ||
], | ||
"private": true, | ||
"dependencies": { | ||
"app-layout": "polymerelements/app-layout#^0.9.0", | ||
"app-route": "polymerelements/app-route#^0.9.1", | ||
"iron-flex-layout": "polymerelements/iron-flex-layout#^1.0.0", | ||
"iron-icon": "polymerelements/iron-icon#^1.0.0", | ||
"iron-iconset-svg": "polymerelements/iron-iconset-svg#^1.0.0", | ||
"iron-localstorage": "polymerelements/iron-localstorage#^1.0.0", | ||
"iron-media-query": "polymerelements/iron-media-query#^1.0.0", | ||
"iron-pages": "polymerelements/iron-pages#^1.0.0", | ||
"iron-selector": "polymerelements/iron-selector#^1.0.0", | ||
"paper-icon-button": "PolymerElements/paper-icon-button#~1.1.1", | ||
"polymer": "polymer/polymer#^1.4.0" | ||
}, | ||
"devDependencies": { | ||
"web-component-tester": "^4.0.0" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<!-- | ||
@license | ||
Copyright (c) 2016 The Polymer Project Authors. All rights reserved. | ||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt | ||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | ||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt | ||
Code distributed by Google as part of the polymer project is also | ||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt | ||
--> | ||
|
||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes"> | ||
|
||
<title>My App</title> | ||
|
||
<link rel="shortcut icon" sizes="32x32" href="/images/app-icon-32.png"> | ||
|
||
<meta name="theme-color" content="#fff"> | ||
<link rel="manifest" href="/manifest.json"> | ||
|
||
<script> | ||
|
||
// setup Polymer options | ||
window.Polymer = {lazyRegister: true, dom: 'shadow'}; | ||
|
||
// load webcomponents polyfills | ||
(function() { | ||
if ('registerElement' in document | ||
&& 'import' in document.createElement('link') | ||
&& 'content' in document.createElement('template')) { | ||
// browser has web components | ||
} else { | ||
// polyfill web components | ||
var e = document.createElement('script'); | ||
e.src = '/bower_components/webcomponentsjs/webcomponents-lite.min.js'; | ||
document.head.appendChild(e); | ||
} | ||
})(); | ||
|
||
// load pre-caching service worker | ||
if ('serviceWorker' in navigator) { | ||
window.addEventListener('load', function() { | ||
navigator.serviceWorker.register('/service-worker.js'); | ||
}); | ||
} | ||
|
||
</script> | ||
|
||
<link rel="import" href="/src/my-app.html"> | ||
|
||
<style> | ||
|
||
body { | ||
margin: 0; | ||
font-family: 'Roboto', 'Noto', sans-serif; | ||
line-height: 1.5; | ||
min-height: 100vh; | ||
background-color: #eee; | ||
} | ||
|
||
</style> | ||
|
||
</head> | ||
<body> | ||
|
||
<my-app></my-app> | ||
|
||
</body> | ||
</html> |
Oops, something went wrong.