Add phosphor pre-preprocessor, to improve readability of code

This commit is contained in:
Michał 2024-04-27 18:17:37 +01:00
parent bfbd393b46
commit 2686fb904c
11 changed files with 24 additions and 26 deletions

View file

@ -2,11 +2,9 @@
import Router from 'svelte-spa-router'; import Router from 'svelte-spa-router';
import { replace, link } from 'svelte-spa-router'; import { replace, link } from 'svelte-spa-router';
import active from 'svelte-spa-router/active' import active from 'svelte-spa-router/active'
import { TwitterLogo, FacebookLogo, InstagramLogo, TiktokLogo } from 'phosphor-svelte';
import routes from '%/routes.js'; import routes from '%/routes.js';
import TwitterLogo from 'phosphor-svelte/lib/TwitterLogo';
import FacebookLogo from 'phosphor-svelte/lib/FacebookLogo';
import InstagramLogo from 'phosphor-svelte/lib/InstagramLogo';
import TiktokLogo from 'phosphor-svelte/lib/TiktokLogo';
import Logo from '/LogoAlt.svg'; import Logo from '/LogoAlt.svg';
const links = { const links = {

View file

@ -1,5 +1,5 @@
<script> <script>
import CaretDown from "phosphor-svelte/lib/CaretDown"; import { CaretDown } from "phosphor-svelte";
export let open = false; export let open = false;
export let name; export let name;

View file

@ -1,11 +1,7 @@
<script> <script>
import { link } from 'svelte-spa-router'; import { link } from 'svelte-spa-router';
import Acorn from 'phosphor-svelte/lib/Acorn'; import { Acorn, Fish, Leaf, Pepper, ArrowUpRight, GrainsSlash } from 'phosphor-svelte';
import Fish from 'phosphor-svelte/lib/Fish';
import Leaf from 'phosphor-svelte/lib/Leaf';
import Pepper from 'phosphor-svelte/lib/Pepper';
import ArrowUpRight from 'phosphor-svelte/lib/ArrowUpRight';
import GrainsSlash from 'phosphor-svelte/lib/GrainsSlash';
import LoadingImage from '/MenuItemLoadingAlt.svg'; import LoadingImage from '/MenuItemLoadingAlt.svg';
export let id; export let id;

View file

@ -29,7 +29,7 @@ export default Items = [
}, },
{ {
name: "half eaten mouldy bread", name: "half eaten mouldy bread",
price: -9999, price: -99,
labels: ["nut"], labels: ["nut"],
}, },
{ {

View file

@ -1,5 +1,5 @@
<script> <script>
import SmileySad from "phosphor-svelte/lib/SmileySad"; import { SmileySad } from "phosphor-svelte";
</script> </script>
<div> <div>

View file

@ -1,5 +1,6 @@
<script> <script>
import PaperPlaneRight from "phosphor-svelte/lib/PaperPlaneRight"; import { PaperPlaneRight } from "phosphor-svelte";
import DropDown from "%/components/DropDown.svelte"; import DropDown from "%/components/DropDown.svelte";
import { expandOnTyping } from "%/lib/utils.js"; import { expandOnTyping } from "%/lib/utils.js";

View file

@ -2,7 +2,8 @@
import { onMount } from "svelte"; import { onMount } from "svelte";
import { link } from 'svelte-spa-router'; import { link } from 'svelte-spa-router';
import { map, tileLayer, marker } from 'leaflet'; import { map, tileLayer, marker } from 'leaflet';
import ArrowUpRight from "phosphor-svelte/lib/ArrowUpRight"; import { ArrowUpRight } from "phosphor-svelte";
import MenuList from "%/components/MenuList.svelte"; import MenuList from "%/components/MenuList.svelte";
import { getPopularToday } from "%/lib/api.js"; import { getPopularToday } from "%/lib/api.js";
import BannerImage from '/BannerExampleImage.jpg'; import BannerImage from '/BannerExampleImage.jpg';

View file

@ -32,12 +32,6 @@
<MenuList items={items} /> <MenuList items={items} />
</div> </div>
<div class="spacer"></div>
<div class="other">
<h2>Popular</h2>
<MenuList items={items} />
</div>
<style lang="scss"> <style lang="scss">
@import "%/styles/vars"; @import "%/styles/vars";

View file

@ -1,5 +1,6 @@
<script> <script>
import ArrowClockwise from "phosphor-svelte/lib/ArrowClockwise"; import { ArrowClockwise } from "phosphor-svelte";
import MenuList from "%/components/MenuList.svelte"; import MenuList from "%/components/MenuList.svelte";
import DropDown from "%/components/DropDown.svelte"; import DropDown from "%/components/DropDown.svelte";
import { getMenuItems } from "%/lib/api.js"; import { getMenuItems } from "%/lib/api.js";

View file

@ -1,7 +1,11 @@
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte' import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'
import { phosphorSvelteOptimize } from "phosphor-svelte/preprocessor"
export default { export default {
// Consult https://svelte.dev/docs#compile-time-svelte-preprocess // Consult https://svelte.dev/docs#compile-time-svelte-preprocess
// for more information about preprocessors // for more information about preprocessors
preprocess: vitePreprocess(), preprocess: [
phosphorSvelteOptimize(),
vitePreprocess()
],
} }

View file

@ -3,10 +3,13 @@ import { svelte } from '@sveltejs/vite-plugin-svelte'
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
base: './',
plugins: [ plugins: [
svelte(), svelte(),
], ],
base: './', optimizeDeps: {
exclude: ["phosphor-svelte"],
},
resolve: { resolve: {
alias: { alias: {
'%': __dirname + '/src', '%': __dirname + '/src',