-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathindex.js
More file actions
64 lines (55 loc) · 1.62 KB
/
index.js
File metadata and controls
64 lines (55 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import Vue from 'vue'
import './plugins/codegen'
import envInject from './plugins/envInject'
Vue.config.productionTip = false
// Setup webfonts
import WebFont from 'webfontloader'
WebFont.load({
google: {
families: ["Montserrat:200,400", "Roboto:400,700", "Source Code Pro:400"]
}
})
// Setup vue-head
import VueHead from 'vue-head'
Vue.use(VueHead)
// Setup vue-highlight.js
import VueHighlightJS from 'vue-highlight.js'
import 'vue-highlight.js/lib/allLanguages'
import 'highlight.js/styles/default.css'
Vue.use(VueHighlightJS)
// Setup fontawesome
import { library } from '@fortawesome/fontawesome-svg-core'
import { faChevronDown, faCog, faHeart, faQuestionCircle } from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
library.add(faChevronDown)
library.add(faCog)
library.add(faHeart)
library.add(faQuestionCircle)
Vue.component('font-awesome-icon', FontAwesomeIcon)
// Smooth scrolling helper function
Vue.prototype.$smoothScroll = id => {
history.pushState({}, '', "#" + id)
if(id == "") id = "top"
let ele = document.getElementById(id)
if(!ele)
return console.log("cannot scroll to missing ele", id)
document.getElementById(id).scrollIntoView({
behavior: "smooth"
})
}
// Path hashing function
Vue.prototype.$hashPath = (path, method) => {
path = path.replace(/[^a-zA-Z0-9_-]+/g, "-")
let hash = `${method}-${path}`
return hash.replace(/-+$/g, "").toLowerCase()
}
// Initialise Vue
import store from './store'
import index from './index.vue'
;(async () => {
await envInject()
new Vue({
store: store,
render: h => h(index)
}).$mount('#app')
})()