Skip to content

Commit c3eaadf

Browse files
committed
refactor layout to opitmize time to content
NOTE: pick up from 36772a7b7c0bb93350245900a3c782a463a00c4e
1 parent 3ef092d commit c3eaadf

File tree

7 files changed

+44
-44
lines changed

7 files changed

+44
-44
lines changed

themes/vue/layout/index.ejs

-2
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@
6161
Copyright &copy; 2014-<%- new Date().getFullYear() %> Evan You
6262
</div>
6363

64-
<script src="//cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script>
65-
<script src="/js/common.js"></script>
6664
<script>
6765
var topScrolled = false
6866
window.addEventListener('scroll', function () {

themes/vue/layout/layout.ejs

+44-11
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,17 @@
1717
<meta name="twitter:description" content="<%- theme.site_description %>">
1818
<meta name="twitter:image" content="https://<%- theme.root_domain %>/images/logo.png">
1919

20+
<link rel="icon" href="/images/logo.png" type="image/x-icon">
21+
2022
<link href='//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600|Roboto Mono' rel='stylesheet' type='text/css'>
2123
<link href='//fonts.googleapis.com/css?family=Dosis:500&text=Vue.js' rel='stylesheet' type='text/css'>
22-
<link href="//cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css" rel='stylesheet' type='text/css'>
23-
<link rel="icon" href="/images/logo.png" type="image/x-icon">
24-
<script>
25-
window.PAGE_TYPE = "<%- page.type %>"
26-
</script>
24+
25+
<!-- main page styles -->
2726
<%- css(isIndex ? 'css/index' : 'css/page') %>
28-
<%- partial('partials/ga') %>
27+
28+
<!-- this needs to be loaded before guide's inline scripts -->
2929
<script src="/js/vue.js"></script>
30+
<script>window.PAGE_TYPE = "<%- page.type %>"</script>
3031
</head>
3132
<body class="<%- isIndex ? '' : 'docs' -%>">
3233
<div id="mobile-bar" <%- isIndex ? 'class="top"' : '' %>>
@@ -42,18 +43,50 @@
4243
<%- body %>
4344
<% } %>
4445
</div>
45-
<script src="//cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script>
4646
<script src="/js/smooth-scroll.min.js"></script>
47-
<script src="/js/common.js"></script>
4847
<% } else { %>
4948
<%- body %>
5049
<% } %>
5150

51+
<!-- main custom script for sidebars, version selects etc. -->
52+
<script src="/js/common.js"></script>
53+
54+
<!-- ga -->
55+
<script>
56+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
57+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
58+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
59+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
60+
61+
ga('create', '<%- theme.google_analytics %>', '<%- theme.root_domain %>');
62+
ga('send', 'pageview');
63+
</script>
64+
65+
<!-- search -->
66+
<link href="//cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css" rel='stylesheet' type='text/css'>
67+
<%- css('css/search') %>
68+
<script src="//cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script>
69+
<script>
70+
[
71+
'#search-query-nav',
72+
'#search-query-sidebar'
73+
].forEach(function (selector) {
74+
if (!document.querySelector(selector)) return
75+
docsearch({
76+
appId: 'BH4D9OD16A',
77+
apiKey: '0a75952972806d9ad07e387d08e9cc4c',
78+
indexName: 'vuejs_jp',
79+
inputSelector: selector
80+
})
81+
})
82+
</script>
83+
84+
<!-- fastclick -->
5285
<script src="//cdnjs.cloudflare.com/ajax/libs/fastclick/1.0.6/fastclick.min.js"></script>
5386
<script>
54-
document.addEventListener('DOMContentLoaded', function() {
55-
FastClick.attach(document.body);
56-
}, false);
87+
document.addEventListener('DOMContentLoaded', function() {
88+
FastClick.attach(document.body);
89+
}, false);
5790
</script>
5891
</body>
5992
</html>

themes/vue/layout/partials/ga.ejs

-9
This file was deleted.

themes/vue/source/css/index.styl

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
@import "_common"
22
@import "_header"
3-
@import "_search"
43
@import '_sidebar'
54

65
$width = 900px

themes/vue/source/css/page.styl

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@import "_common"
22
@import "_header"
33
@import "_demo"
4-
@import "_search"
54
@import "_sponsor"
65
@import "_migration"
76
@import "_sidebar"

themes/vue/source/js/common.js

-20
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
(function () {
22

3-
initSearch()
43
initMobileMenu()
54
if (PAGE_TYPE) {
65
initVersionSelect()
@@ -31,25 +30,6 @@
3130
}
3231
}
3332

34-
/**
35-
* Swiftype search box
36-
*/
37-
38-
function initSearch () {
39-
[
40-
'#search-query-nav',
41-
'#search-query-sidebar'
42-
].forEach(function (selector) {
43-
if (!document.querySelector(selector)) return
44-
docsearch({
45-
//appId: 'BH4D9OD16A',
46-
apiKey: '0a75952972806d9ad07e387d08e9cc4c',
47-
indexName: 'vuejs_jp',
48-
inputSelector: selector
49-
})
50-
})
51-
}
52-
5333
/**
5434
* Mobile burger menu button for toggling sidebar
5535
*/

0 commit comments

Comments
 (0)