Skip to content

(Hopefully) Complete PWA support (fixes #769, #771) #918

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,37 @@ markdown:
smartLists: true
smartypants: true

# Offline
## Config passed to sw-precache
## https://github.com/JLHwung/hexo-offline
offline:
maximumFileSizeToCacheInBytes: 10485760
staticFileGlobs:
- public/**/*.{js,html,css,png,jpg,gif,svg,eot,ttf,woff,json,xml}
stripPrefix: public
verbose: true
runtimeCaching:
- urlPattern: /*
handler: cacheFirst
options:
origin: sendgrid.sp1.convertro.com
- urlPattern: /*
handler: cacheFirst
options:
origin: ad.doubleclick.net
- urlPattern: /*
handler: cacheFirst
options:
origin: cdn.jsdelivr.net
- urlPattern: /*
handler: cacheFirst
options:
origin: fonts.googleapis.com
- urlPattern: /*
handler: cacheFirst
options:
origin: fonts.gstatic.com

# Deployment
## Docs: http://zespia.tw/hexo/docs/deployment.html
deploy:
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"hexo-generator-feed": "^1.1.0",
"hexo-generator-index": "^0.2.0",
"hexo-generator-tag": "^0.2.0",
"hexo-offline": "^0.2.0",
"hexo-renderer-ejs": "^0.2.0",
"hexo-renderer-marked": "^0.2.10",
"hexo-renderer-stylus": "^0.3.1",
Expand Down
3 changes: 3 additions & 0 deletions src/menu/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
type: menu
---
23 changes: 22 additions & 1 deletion themes/vue/layout/layout.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,28 @@
<meta name="twitter:description" content="<%- theme.site_description %>">
<meta name="twitter:image" content="https://<%- theme.root_domain %>/images/logo.png">

<link rel="apple-touch-icon" sizes="57x57" href="<%- url_for("/images/icons/apple-icon-57x57.png") %>">
<link rel="apple-touch-icon" sizes="60x60" href="<%- url_for("/images/icons/apple-icon-60x60.png") %>">
<link rel="apple-touch-icon" sizes="72x72" href="<%- url_for("/images/icons/apple-icon-72x72.png") %>">
<link rel="apple-touch-icon" sizes="76x76" href="<%- url_for("/images/icons/apple-icon-76x76.png") %>">
<link rel="apple-touch-icon" sizes="114x114" href="<%- url_for("/images/icons/apple-icon-114x114.png") %>">
<link rel="apple-touch-icon" sizes="120x120" href="<%- url_for("/images/icons/apple-icon-120x120.png") %>">
<link rel="apple-touch-icon" sizes="144x144" href="<%- url_for("/images/icons/apple-icon-144x144.png") %>">
<link rel="apple-touch-icon" sizes="152x152" href="<%- url_for("/images/icons/apple-icon-152x152.png") %>">
<link rel="apple-touch-icon" sizes="180x180" href="<%- url_for("/images/icons/apple-icon-180x180.png") %>">
<link rel="icon" type="image/png" sizes="192x192" href="<%- url_for("/images/icons/android-icon-192x192.png") %>">
<link rel="icon" type="image/png" sizes="32x32" href="<%- url_for("/images/icons/favicon-32x32.png") %>">
<link rel="icon" type="image/png" sizes="96x96" href="<%- url_for("/images/icons/favicon-96x96.png") %>">
<link rel="icon" type="image/png" sizes="16x16" href="<%- url_for("/images/icons/favicon-16x16.png") %>">
<meta name="msapplication-TileImage" content="/images/icons/ms-icon-144x144.png">
<link rel="icon" href="<%- url_for("/images/logo.png") %>" type="image/png">

<meta name="msapplication-TileColor" content="#4fc08d">
<meta name="theme-color" content="#4fc08d">

<meta name="msapplication-config" content="browserconfig.xml">
<link rel="manifest" href="/manifest.json">

<link href='//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600|Roboto Mono' rel='stylesheet' type='text/css'>
<link href='//fonts.googleapis.com/css?family=Dosis:500&text=Vue.js' rel='stylesheet' type='text/css'>

Expand Down Expand Up @@ -70,7 +90,8 @@
<script>
[
'#search-query-nav',
'#search-query-sidebar'
'#search-query-sidebar',
'#search-query-menu'
].forEach(function (selector) {
if (!document.querySelector(selector)) return
// search index defaults to v2
Expand Down
11 changes: 9 additions & 2 deletions themes/vue/layout/page.ejs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% if (page.type) { %>
<%- partial('partials/sidebar', { type: page.type, index: page.index }) %>
<%- partial('partials/sidebar', { type: page.type === 'menu' ? 'guide' : page.type, index: page.index }) %>
<% } else { %>
<div class="sidebar">
<ul class="main-menu">
Expand All @@ -9,7 +9,14 @@
<% } %>
<div class="content <%- page.type ? page.type + ' with-sidebar' : '' %> <%- page.type === 'guide' ? page.path.replace(/.+\//, '').replace('.html', '') + '-guide' : '' %>">
<% if (page.type) { %>
<%- partial('partials/ad') %>
<% if (page.type === 'menu') { %>
<form id="search-form">
<input type="text" id="search-query-menu" class="search-query st-default-search-input">
</form>
<%- partial('partials/toc', { type: 'guide' }) %>
<% } else { %>
<%- partial('partials/ad') %>
<% } %>
<% } %>
<% if (page.title.trim()) { %>
<h1><%- page.title %><%- page.type === 'examples' ? ' Example' : '' %></h1>
Expand Down
39 changes: 1 addition & 38 deletions themes/vue/layout/partials/sidebar.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -23,43 +23,6 @@
</select>
<% } %>
</h2>
<ul class="menu-root">
<% type !== 'api' && site.pages.find({type: type}).sort('order').each(function (p) { %>
<% var fileName = p.path.replace(/^.+?\/([\w-]+)\.html/, '$1') %>
<% if (type === 'guide') { %>
<% if (fileName === 'installation') { %>
<li><h3>Essentials</h3></li>
<% } %>
<% if (fileName === 'reactivity') { %>
<li><h3>Advanced</h3></li>
<% } %>
<% if (fileName === 'migration') { %>
<li><h3>Migrating</h3></li>
<% } %>
<% if (fileName === 'comparison') { %>
<li><h3>Meta</h3></li>
<% } %>
<% } %>
<% if (type === 'cookbook') { %>
<% if (p.order === 1.1) { %>
<li><h3>Vue Instance</h3></li>
<% } %>
<!-- Move cookbook sections here once they have -->
<!-- at least one recipe -->
<% } %>
<li>
<a href="<%- url_for(p.path) %>" class="sidebar-link<%- page.title === p.title ? ' current' : '' %><%- p.is_new ? ' new' : '' %>"><%- p.title %></a>
</li>
<% }) %>
<% if (type === 'cookbook') { %>
<li><h3>Components</h3></li>
<li><h4>Form Inputs</h4></li>
<li><h4>3rd-Party Integrations</h4></li>
<li><h3>Transitions</h3></li>
<li><h3>Directives</h3></li>
<li><h3>Vue Router</h3></li>
<li><h3>Vuex</h3></li>
<% } %>
</ul>
<%- partial('partials/toc', { type: type }) %>
</div>
</div>
38 changes: 38 additions & 0 deletions themes/vue/layout/partials/toc.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<ul class="menu-root">
<% type !== 'api' && site.pages.find({type: type}).sort('order').each(function (p) { %>
<% var fileName = p.path.replace(/^.+?\/([\w-]+)\.html/, '$1') %>
<% if (type === 'guide') { %>
<% if (fileName === 'installation') { %>
<li><h3>Essentials</h3></li>
<% } %>
<% if (fileName === 'reactivity') { %>
<li><h3>Advanced</h3></li>
<% } %>
<% if (fileName === 'migration') { %>
<li><h3>Migrating</h3></li>
<% } %>
<% if (fileName === 'comparison') { %>
<li><h3>Meta</h3></li>
<% } %>
<% } %>
<% if (type === 'cookbook') { %>
<% if (p.order === 1.1) { %>
<li><h3>Vue Instance</h3></li>
<% } %>
<!-- Move cookbook sections here once they have -->
<!-- at least one recipe -->
<% } %>
<li>
<a href="<%- url_for(p.path) %>" class="sidebar-link<%- page.title === p.title ? ' current' : '' %><%- p.is_new ? ' new' : '' %>"><%- p.title %></a>
</li>
<% }) %>
<% if (type === 'cookbook') { %>
<li><h3>Components</h3></li>
<li><h4>Form Inputs</h4></li>
<li><h4>3rd-Party Integrations</h4></li>
<li><h3>Transitions</h3></li>
<li><h3>Directives</h3></li>
<li><h3>Vue Router</h3></li>
<li><h3>Vuex</h3></li>
<% } %>
</ul>
11 changes: 11 additions & 0 deletions themes/vue/source/browserconfig.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square70x70logo src="/images/icons/ms-icon-70x70.png" />
<square150x150logo src="/images/icons/ms-icon-150x150.png" />
<square310x310logo src="/images/icons/ms-icon-310x310.png" />
<TileColor>#ffffff</TileColor>
</tile>
</msapplication>
</browserconfig>
15 changes: 15 additions & 0 deletions themes/vue/source/css/_offline-menu.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.content.menu
font-size: 1.2em
.menu-root
padding-left: 0
#search-form, .algolia-autocomplete, input
width: 100%
.aa-dropdown-menu
box-sizing: border-box
h3
margin: 1.5em 0 .75em
&:before, &:after
display: none
li
list-style-type: none
margin-top: .1em
1 change: 1 addition & 0 deletions themes/vue/source/css/page.styl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@import "_sponsor"
@import "_migration"
@import "_sidebar"
@import "_offline-menu"

#header
box-shadow 0 0 1px rgba(0,0,0,.25)
Expand Down
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.
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.
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.
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.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added themes/vue/source/images/icons/apple-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added themes/vue/source/images/icons/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added themes/vue/source/images/icons/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added themes/vue/source/images/icons/favicon-96x96.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added themes/vue/source/images/icons/favicon.ico
Binary file not shown.
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.
Binary file added themes/vue/source/images/icons/ms-icon-70x70.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions themes/vue/source/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"background_color": "#ffffff",
"description": "The Progressive JavaScript Framework",
"display": "standalone",
"icons": [
{
"src": "\/images\/icons\/android-icon-36x36.png",
"sizes": "36x36",
"type": "image\/png",
"density": "0.75"
},
{
"src": "\/images\/icons\/android-icon-48x48.png",
"sizes": "48x48",
"type": "image\/png",
"density": "1.0"
},
{
"src": "\/images\/icons\/android-icon-72x72.png",
"sizes": "72x72",
"type": "image\/png",
"density": "1.5"
},
{
"src": "\/images\/icons\/android-icon-96x96.png",
"sizes": "96x96",
"type": "image\/png",
"density": "2.0"
},
{
"src": "\/images\/icons\/android-icon-144x144.png",
"sizes": "144x144",
"type": "image\/png",
"density": "3.0"
},
{
"src": "\/images\/icons\/android-icon-192x192.png",
"sizes": "192x192",
"type": "image\/png",
"density": "4.0"
}
],
"lang": "en-US",
"name": "Vue.js",
"short_name": "Vue",
"start_url": "./menu",
"theme_color": "#4fc08d"
}
Loading