From d823f2805422a992893cb31be854a119e7e0b988 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fe=CC=81lix=20Pe=CC=81ault?= Date: Tue, 3 Mar 2020 15:36:57 +0100 Subject: [PATCH] Restructure utility files, Use a bundle.css to fix CSS issues --- pnpm-lock.yaml | 14 --------- rollup.config.js | 29 ++++++++++--------- src/atoms/IconGlobe.svelte | 2 +- src/atoms/IconGlobeSmall.svelte | 2 +- src/atoms/LinkTranslate.svelte | 2 +- src/atoms/TitleSite.svelte | 2 +- src/molecules/InteractiveGlobe.svelte | 2 +- src/molecules/Photo.svelte | 4 +-- src/molecules/Switcher.svelte | 4 +-- src/organisms/Carousel.svelte | 4 +-- src/organisms/Footer.svelte | 2 +- src/organisms/Locations.svelte | 7 ++--- src/organisms/Pagination.svelte | 2 +- src/routes/_layout.svelte | 22 +++++++------- src/routes/choose.svelte | 4 ++- src/routes/credits.svelte | 2 +- src/routes/index.svelte | 6 ++-- .../location/[country]/[location].svelte | 4 +-- .../[country]/[location]/[photo].svelte | 4 +-- src/template.html | 5 ++-- src/{ => utils}/animations.js | 0 src/{ => utils}/functions.js | 0 src/{ => utils}/store.js | 0 23 files changed, 56 insertions(+), 67 deletions(-) rename src/{ => utils}/animations.js (100%) rename src/{ => utils}/functions.js (100%) rename src/{ => utils}/store.js (100%) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2f414da..d332cca 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,11 +1,9 @@ dependencies: - '@polka/send': 0.4.0 animejs: 3.1.0 compression: 1.7.4 dayjs: 1.8.21 imagesloaded: 4.1.4 lazysizes: 5.2.0 - node-fetch: 2.6.0 normalize.css: 8.0.1 polka: 1.0.0-next.11 shufflejs: 5.2.3 @@ -852,10 +850,6 @@ packages: node: '>=4.0.0' resolution: integrity: sha512-5a6wqoJV/xEdbRNKVo6I4hO3VjyDq//8q2f9I6PBAvMesJHFauXDorcNCsr9RzvsZnaWi5NYCcfyqP1QeFHFbw== - /@polka/send/0.4.0: - dev: false - resolution: - integrity: sha1-4nccVnHTYXWDJTSriGqIT3XzHm8= /@polka/url/0.5.0: dev: false resolution: @@ -2762,12 +2756,6 @@ packages: dev: true resolution: 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: dependencies: fstream: 1.0.12 @@ -4449,7 +4437,6 @@ specifiers: '@babel/plugin-transform-runtime': ^7.8.3 '@babel/preset-env': ^7.8.6 '@babel/runtime': ^7.8.4 - '@polka/send': ^0.4.0 '@rollup/plugin-commonjs': ^11.0.2 '@rollup/plugin-node-resolve': ^7.1.1 '@rollup/plugin-replace': ^2.3.1 @@ -4467,7 +4454,6 @@ specifiers: eslint-plugin-svelte3: ^2.7.3 imagesloaded: ^4.1.4 lazysizes: ^5.2.0 - node-fetch: ^2.6.0 node-sass: ^4.13.1 normalize.css: ^8.0.1 polka: ^1.0.0-next.9 diff --git a/rollup.config.js b/rollup.config.js index 035d837..2025f00 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -5,7 +5,7 @@ import svelte from 'rollup-plugin-svelte' import babel from 'rollup-plugin-babel' // import { eslint } from 'rollup-plugin-eslint' // import browsersync from 'rollup-plugin-browsersync' -import sveltePreprocess from 'svelte-preprocess' +import autoPreprocess from 'svelte-preprocess' import { terser } from 'rollup-plugin-terser' import config from 'sapper/config/rollup' 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) // Preprocessors -const preprocess = sveltePreprocess({ - scss: { includePaths: ['node_modules', 'src'] }, +const preprocess = autoPreprocess({ + scss: { + includePaths: ['src', 'node_modules'], + }, postcss: true }) @@ -33,21 +35,22 @@ export default { input: config.client.input(), output: { ...config.client.output(), - ...dev && { exports: 'named' } + // ...dev && { exports: 'named' } }, - experimentalCodeSplitting: true, + // experimentalCodeSplitting: true, plugins: [ // Javascript - svelte({ - dev, - preprocess, - hydratable: true, - emitCss: true - }), replace({ 'process.browser': true, 'process.env.NODE_ENV': JSON.stringify(mode) }), + svelte({ + dev, + hydratable: true, + emitCss: false, + css: css => css.write('static/bundle.css'), + preprocess + }), resolve({ browser: true, extensions: ['.mjs', '.js', '.svelte', '.scss', '.json', '.html'], @@ -84,8 +87,8 @@ export default { }), svelte({ dev, - preprocess, - generate: 'ssr' + generate: 'ssr', + preprocess }), resolve({ browser: true, diff --git a/src/atoms/IconGlobe.svelte b/src/atoms/IconGlobe.svelte index ac0d28e..fc56bf0 100644 --- a/src/atoms/IconGlobe.svelte +++ b/src/atoms/IconGlobe.svelte @@ -1,5 +1,5 @@
diff --git a/src/molecules/InteractiveGlobe.svelte b/src/molecules/InteractiveGlobe.svelte index 53323e3..d868f70 100644 --- a/src/molecules/InteractiveGlobe.svelte +++ b/src/molecules/InteractiveGlobe.svelte @@ -4,7 +4,7 @@ // Lead 3: https://www.bypeople.com/css-js-webgl-rotating-3d-globe-effect/ import { onMount } from 'svelte' - import { locations } from '../store' + import { locations } from '../utils/store' // Props diff --git a/src/molecules/Photo.svelte b/src/molecules/Photo.svelte index e1af0d4..d329e56 100644 --- a/src/molecules/Photo.svelte +++ b/src/molecules/Photo.svelte @@ -2,8 +2,8 @@ import { onMount } from 'svelte' import { fly } from 'svelte/transition' import { quartOut } from 'svelte/easing' - import { site, currentLocation } from '../store' - import * as fn from '../functions' + import { site, currentLocation } from '../utils/store' + import * as fn from '../utils/functions' // Dependencies import * as basicScroll from 'basicscroll' diff --git a/src/molecules/Switcher.svelte b/src/molecules/Switcher.svelte index 2ff4e62..34cb069 100644 --- a/src/molecules/Switcher.svelte +++ b/src/molecules/Switcher.svelte @@ -1,7 +1,5 @@ @@ -82,9 +83,8 @@ $locations.forEach(loc => loc.country = $countries.find(cont => cont.id === loc.country.id)) - diff --git a/src/routes/choose.svelte b/src/routes/choose.svelte index c3f2f1c..7f4f958 100644 --- a/src/routes/choose.svelte +++ b/src/routes/choose.svelte @@ -4,7 +4,9 @@ site, currentLocation, currentPhotos - } from '../store' + } from '../utils/store' + + // Depencencies import AOS from 'aos' // Components diff --git a/src/routes/credits.svelte b/src/routes/credits.svelte index e070ae6..9ef07c3 100644 --- a/src/routes/credits.svelte +++ b/src/routes/credits.svelte @@ -1,6 +1,6 @@