Created
December 17, 2018 09:28
-
-
Save tolyanor/fa602348bcc40d18a9a44a532e0bf22b to your computer and use it in GitHub Desktop.
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
module.exports = { | |
head: { | |
title: "Конструктор", | |
meta: [ | |
{ charset: 'utf-8' }, | |
{ name: "viewport", content: "width=device-width, initial-scale=1, shrink-to-fit=no" }, | |
], | |
link: [ | |
{ href: 'vendor/bootstrap/css/bootstrap.min.css', type: 'text/css', rel: 'stylesheet' }, | |
{ href: 'vendor/fontawesome-free/css/all.min.css', type: 'text/css', rel: 'stylesheet' }, | |
{ href: 'https://fonts.googleapis.com/css?family=Montserrat:400,700', type: 'text/css', rel: 'stylesheet' }, | |
{ href: 'https://fonts.googleapis.com/css?family=Kaushan+Script', type: 'text/css', rel: 'stylesheet' }, | |
{ href: 'https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic,700italic', type: 'text/css', rel: 'stylesheet' }, | |
{ href: 'https://fonts.googleapis.com/css?family=Roboto+Slab:400,100,300,700', type: 'text/css', rel: 'stylesheet' }, | |
{ href: 'css/agency.min.css', type: 'text/css', rel: 'stylesheet' }, | |
], | |
script: [ | |
{ src: 'vendor/jquery/jquery.min.js'}, | |
{ src: 'vendor/bootstrap/js/bootstrap.bundle.min.js'}, | |
{ src: 'vendor/jquery-easing/jquery.easing.min.js'}, | |
{ src: 'js/agency.min.js'}, | |
] | |
}, | |
build: { | |
extractCSS: true, | |
}, | |
router: { | |
scrollBehavior: async (to, from, savedPosition) => { | |
if (savedPosition) { | |
return savedPosition | |
} | |
const findEl = async (hash, x) => { | |
return document.querySelector(hash) || | |
new Promise((resolve, reject) => { | |
if (x > 50) { | |
return resolve() | |
} | |
setTimeout(() => { resolve(findEl(hash, ++x || 1)) }, 100) | |
}) | |
} | |
if (to.hash) { | |
let el = await findEl(to.hash) | |
if ('scrollBehavior' in document.documentElement.style) { | |
return window.scrollTo({ top: el.offsetTop, behavior: 'smooth' }) | |
} else { | |
return window.scrollTo(0, el.offsetTop) | |
} | |
} | |
return { x: 0, y: 0 } | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment