Restructure utility files, Use a bundle.css to fix CSS issues
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-03-03 15:36:57 +01:00
parent 241c30fb52
commit d823f28054
23 changed files with 56 additions and 67 deletions

14
pnpm-lock.yaml generated
View File

@@ -1,11 +1,9 @@
dependencies: dependencies:
'@polka/send': 0.4.0
animejs: 3.1.0 animejs: 3.1.0
compression: 1.7.4 compression: 1.7.4
dayjs: 1.8.21 dayjs: 1.8.21
imagesloaded: 4.1.4 imagesloaded: 4.1.4
lazysizes: 5.2.0 lazysizes: 5.2.0
node-fetch: 2.6.0
normalize.css: 8.0.1 normalize.css: 8.0.1
polka: 1.0.0-next.11 polka: 1.0.0-next.11
shufflejs: 5.2.3 shufflejs: 5.2.3
@@ -852,10 +850,6 @@ packages:
node: '>=4.0.0' node: '>=4.0.0'
resolution: resolution:
integrity: sha512-5a6wqoJV/xEdbRNKVo6I4hO3VjyDq//8q2f9I6PBAvMesJHFauXDorcNCsr9RzvsZnaWi5NYCcfyqP1QeFHFbw== integrity: sha512-5a6wqoJV/xEdbRNKVo6I4hO3VjyDq//8q2f9I6PBAvMesJHFauXDorcNCsr9RzvsZnaWi5NYCcfyqP1QeFHFbw==
/@polka/send/0.4.0:
dev: false
resolution:
integrity: sha1-4nccVnHTYXWDJTSriGqIT3XzHm8=
/@polka/url/0.5.0: /@polka/url/0.5.0:
dev: false dev: false
resolution: resolution:
@@ -2762,12 +2756,6 @@ packages:
dev: true dev: true
resolution: resolution:
integrity: sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ== integrity: sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ==
/node-fetch/2.6.0:
dev: false
engines:
node: 4.x || >=6.0.0
resolution:
integrity: sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==
/node-gyp/3.8.0: /node-gyp/3.8.0:
dependencies: dependencies:
fstream: 1.0.12 fstream: 1.0.12
@@ -4449,7 +4437,6 @@ specifiers:
'@babel/plugin-transform-runtime': ^7.8.3 '@babel/plugin-transform-runtime': ^7.8.3
'@babel/preset-env': ^7.8.6 '@babel/preset-env': ^7.8.6
'@babel/runtime': ^7.8.4 '@babel/runtime': ^7.8.4
'@polka/send': ^0.4.0
'@rollup/plugin-commonjs': ^11.0.2 '@rollup/plugin-commonjs': ^11.0.2
'@rollup/plugin-node-resolve': ^7.1.1 '@rollup/plugin-node-resolve': ^7.1.1
'@rollup/plugin-replace': ^2.3.1 '@rollup/plugin-replace': ^2.3.1
@@ -4467,7 +4454,6 @@ specifiers:
eslint-plugin-svelte3: ^2.7.3 eslint-plugin-svelte3: ^2.7.3
imagesloaded: ^4.1.4 imagesloaded: ^4.1.4
lazysizes: ^5.2.0 lazysizes: ^5.2.0
node-fetch: ^2.6.0
node-sass: ^4.13.1 node-sass: ^4.13.1
normalize.css: ^8.0.1 normalize.css: ^8.0.1
polka: ^1.0.0-next.9 polka: ^1.0.0-next.9

View File

@@ -5,7 +5,7 @@ import svelte from 'rollup-plugin-svelte'
import babel from 'rollup-plugin-babel' import babel from 'rollup-plugin-babel'
// import { eslint } from 'rollup-plugin-eslint' // import { eslint } from 'rollup-plugin-eslint'
// import browsersync from 'rollup-plugin-browsersync' // import browsersync from 'rollup-plugin-browsersync'
import sveltePreprocess from 'svelte-preprocess' import autoPreprocess from 'svelte-preprocess'
import { terser } from 'rollup-plugin-terser' import { terser } from 'rollup-plugin-terser'
import config from 'sapper/config/rollup' import config from 'sapper/config/rollup'
import pkg from './package.json' import pkg from './package.json'
@@ -19,8 +19,10 @@ const legacy = !!process.env.SAPPER_LEGACY_BUILD
const onwarn = (warning, onwarn) => (warning.code === 'CIRCULAR_DEPENDENCY' && /[/\\]@sapper[/\\]/.test(warning.message)) || onwarn(warning) const onwarn = (warning, onwarn) => (warning.code === 'CIRCULAR_DEPENDENCY' && /[/\\]@sapper[/\\]/.test(warning.message)) || onwarn(warning)
// Preprocessors // Preprocessors
const preprocess = sveltePreprocess({ const preprocess = autoPreprocess({
scss: { includePaths: ['node_modules', 'src'] }, scss: {
includePaths: ['src', 'node_modules'],
},
postcss: true postcss: true
}) })
@@ -33,21 +35,22 @@ export default {
input: config.client.input(), input: config.client.input(),
output: { output: {
...config.client.output(), ...config.client.output(),
...dev && { exports: 'named' } // ...dev && { exports: 'named' }
}, },
experimentalCodeSplitting: true, // experimentalCodeSplitting: true,
plugins: [ plugins: [
// Javascript // Javascript
svelte({
dev,
preprocess,
hydratable: true,
emitCss: true
}),
replace({ replace({
'process.browser': true, 'process.browser': true,
'process.env.NODE_ENV': JSON.stringify(mode) 'process.env.NODE_ENV': JSON.stringify(mode)
}), }),
svelte({
dev,
hydratable: true,
emitCss: false,
css: css => css.write('static/bundle.css'),
preprocess
}),
resolve({ resolve({
browser: true, browser: true,
extensions: ['.mjs', '.js', '.svelte', '.scss', '.json', '.html'], extensions: ['.mjs', '.js', '.svelte', '.scss', '.json', '.html'],
@@ -84,8 +87,8 @@ export default {
}), }),
svelte({ svelte({
dev, dev,
preprocess, generate: 'ssr',
generate: 'ssr' preprocess
}), }),
resolve({ resolve({
browser: true, browser: true,

View File

@@ -1,5 +1,5 @@
<script> <script>
import * as fn from '../functions' import * as fn from '../utils/functions'
export let width = 56 export let width = 56
export let color = '#000' export let color = '#000'

View File

@@ -1,5 +1,5 @@
<script> <script>
import * as fn from '../functions' import * as fn from '../utils/functions'
export let width = 56 export let width = 56
export let color = '#000' export let color = '#000'

View File

@@ -1,5 +1,5 @@
<script> <script>
import * as fn from '../functions' import * as fn from '../utils/functions'
export let href = '/' export let href = '/'
export let text = '' export let text = ''

View File

@@ -1,5 +1,5 @@
<script> <script>
import * as fn from '../functions' import * as fn from '../utils/functions'
</script> </script>
<div class="title-location title-location--inline"> <div class="title-location title-location--inline">

View File

@@ -4,7 +4,7 @@
// Lead 3: https://www.bypeople.com/css-js-webgl-rotating-3d-globe-effect/ // Lead 3: https://www.bypeople.com/css-js-webgl-rotating-3d-globe-effect/
import { onMount } from 'svelte' import { onMount } from 'svelte'
import { locations } from '../store' import { locations } from '../utils/store'
// Props // Props

View File

@@ -2,8 +2,8 @@
import { onMount } from 'svelte' import { onMount } from 'svelte'
import { fly } from 'svelte/transition' import { fly } from 'svelte/transition'
import { quartOut } from 'svelte/easing' import { quartOut } from 'svelte/easing'
import { site, currentLocation } from '../store' import { site, currentLocation } from '../utils/store'
import * as fn from '../functions' import * as fn from '../utils/functions'
// Dependencies // Dependencies
import * as basicScroll from 'basicscroll' import * as basicScroll from 'basicscroll'

View File

@@ -1,7 +1,5 @@
<script> <script>
import { import { currentLocation } from '../utils/store'
currentLocation,
} from '../store'
// Components // Components
import IconGlobe from '../atoms/IconGlobe' import IconGlobe from '../atoms/IconGlobe'

View File

@@ -1,8 +1,8 @@
<script> <script>
import { onMount, createEventDispatcher } from 'svelte' import { onMount, createEventDispatcher } from 'svelte'
import { stores } from '@sapper/app' import { stores } from '@sapper/app'
import { currentLocation } from '../store' import { currentLocation } from '../utils/store'
import * as fn from '../functions' import * as fn from '../utils/functions'
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
const { page } = stores() const { page } = stores()

View File

@@ -1,6 +1,6 @@
<script> <script>
// Svelte // Svelte
import { site, currentLocation } from '../store' import { site, currentLocation } from '../utils/store'
// Components // Components
import LinkTranslate from '../atoms/LinkTranslate' import LinkTranslate from '../atoms/LinkTranslate'

View File

@@ -1,10 +1,9 @@
<script> <script>
import { onMount } from 'svelte' import { onMount } from 'svelte'
import { flip } from 'svelte/animate' import { flip } from 'svelte/animate'
import { fly, fade } from 'svelte/transition' import { crossfadeReceive, crossfadeSend } from '../utils/animations'
import { locations, countries, continents } from '../store' import { locations, countries, continents } from '../utils/store'
import { crossfadeReceive, crossfadeSend } from '../animations' import * as fn from '../utils/functions'
import * as fn from '../functions'
// Dependencies // Dependencies
import AOS from 'aos' import AOS from 'aos'

View File

@@ -1,6 +1,6 @@
<script> <script>
import { onMount, createEventDispatcher } from 'svelte' import { onMount, createEventDispatcher } from 'svelte'
import { currentLocation } from '../store' import { currentLocation } from '../utils/store'
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
// Props // Props

View File

@@ -5,10 +5,10 @@
continents, continents,
countries, countries,
locations locations
} from '../store' } from '../utils/store'
export async function preload (page, session) { export async function preload (page, session) {
const request = await this.fetch(apiEndpoints.gql, { const req = await this.fetch(apiEndpoints.gql, {
method: 'post', method: 'post',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ query: `{ body: JSON.stringify({ query: `{
@@ -54,13 +54,14 @@
} }
}`}) }`})
}) })
const result = await request.json() const result = await req.json()
if (req.ok) {
// Set data into store // Set data into store
site.set(result.data.site.data[0]) site.set(result.data.site.data[0])
continents.set(result.data.continents.data) continents.set(result.data.continents.data)
countries.set(result.data.countries.data) countries.set(result.data.countries.data)
locations.set(result.data.locations.data) locations.set(result.data.locations.data)
}
} }
</script> </script>
@@ -82,9 +83,8 @@
$locations.forEach(loc => loc.country = $countries.find(cont => cont.id === loc.country.id)) $locations.forEach(loc => loc.country = $countries.find(cont => cont.id === loc.country.id))
</script> </script>
<!-- <style src="../style/style.scss" global></style> -->
<style lang="scss" global> <style lang="scss" global>
@import "./style/style.scss"; @import "../style/style.scss";
</style> </style>
<slot></slot> <slot></slot>

View File

@@ -4,7 +4,9 @@
site, site,
currentLocation, currentLocation,
currentPhotos currentPhotos
} from '../store' } from '../utils/store'
// Depencencies
import AOS from 'aos' import AOS from 'aos'
// Components // Components

View File

@@ -1,6 +1,6 @@
<script> <script>
import { onMount } from 'svelte' import { onMount } from 'svelte'
import { site } from '../store' import { site } from '../utils/store'
// Dependencies // Dependencies
import AOS from 'aos' import AOS from 'aos'

View File

@@ -1,7 +1,7 @@
<script context="module"> <script context="module">
import { import {
apiEndpoints, apiEndpoints,
} from '../store' } from '../utils/store'
// Preload data // Preload data
export async function preload (page, session) { export async function preload (page, session) {
@@ -18,8 +18,8 @@
<script> <script>
import { onMount } from 'svelte' import { onMount } from 'svelte'
import { site, currentLocation, currentPhotos } from '../store' import { site, currentLocation, currentPhotos } from '../utils/store'
import * as fn from '../functions' import * as fn from '../utils/functions'
// Dependencies // Dependencies
import * as basicScroll from 'basicscroll' import * as basicScroll from 'basicscroll'

View File

@@ -5,7 +5,7 @@
locations, locations,
currentLocation, currentLocation,
currentPhotos currentPhotos
} from '../../../store' } from '../../../utils/store'
import { stores } from '@sapper/app' import { stores } from '@sapper/app'
// Preload data // Preload data
@@ -23,7 +23,7 @@
<script> <script>
import { onMount } from 'svelte' import { onMount } from 'svelte'
import * as fn from '../../../functions' import * as fn from '../../../utils/functions'
const { page } = stores() const { page } = stores()
// Dependencies // Dependencies

View File

@@ -5,7 +5,7 @@
locations, locations,
currentLocation, currentLocation,
currentPhotos currentPhotos
} from '../../../../store' } from '../../../../utils/store'
// Define either to preload data or use the store // Define either to preload data or use the store
let preloaded let preloaded
@@ -32,7 +32,7 @@
<script> <script>
import { onMount, createEventDispatcher } from 'svelte' import { onMount, createEventDispatcher } from 'svelte'
import { goto } from '@sapper/app' import { goto } from '@sapper/app'
import * as fn from '../../../../functions' import * as fn from '../../../../utils/functions'
const { page } = stores() const { page } = stores()
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()

View File

@@ -2,13 +2,14 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1"> <meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="theme-color" content="#3C0576">
<link rel="shortcut icon" type="image/png" href="/img/favicon.png"> <link rel="shortcut icon" type="image/png" href="/img/favicon.png">
<link rel="stylesheet" href="/bundle.css">
%sapper.base% %sapper.base%
%sapper.head% %sapper.head%
%sapper.styles%
</head> </head>
<body> <body>