Skip to content

Commit fc93d9a

Browse files
committed
Load SVG icons natively through unplugin, clean-up
1 parent 4d0a071 commit fc93d9a

File tree

7 files changed

+19
-37
lines changed

7 files changed

+19
-37
lines changed

babel.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ module.exports = {
33
'@vue/cli-plugin-babel/preset'
44
],
55
plugins: [
6-
"@babel/plugin-proposal-optional-chaining",
76
"@babel/plugin-proposal-class-properties"
87
]
98
};

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@
7272
"devDependencies": {
7373
"@babel/eslint-parser": "^7.28.4",
7474
"@babel/plugin-proposal-class-properties": "^7.18.6",
75-
"@babel/plugin-proposal-optional-chaining": "^7.21.0",
7675
"@iconify-json/bi": "^1.2.6",
7776
"@vue/cli-plugin-babel": "^5.0.9",
7877
"@vue/cli-plugin-eslint": "^5.0.9",

src/components/MapView.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ export default {
245245
</script>
246246

247247
<style lang="scss">
248-
@import "../../node_modules/ol/ol.css";
248+
@import "ol/ol.css";
249249
250250
#stac-browser {
251251
.map-popover {

src/components/SocialSharing.vue

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
11
<template>
22
<section>
33
<b-button v-for="href, service in urls" :key="service" class="service me-1" :class="service" :href="href" target="_blank">
4-
<i class="svg" :class="service" /> {{ $t(`source.share.${service}`) }}
4+
<component :is="`icon-${service}`" /> {{ $t(`source.share.${service}`) }}
55
</b-button>
66
</section>
77
</template>
88

99

1010
<script>
1111
import { mapState } from 'vuex';
12+
import IconBsky from '~icons/share/bsky';
13+
import IconEmail from '~icons/share/email';
14+
import IconMastodon from '~icons/share/mastodon';
15+
import IconX from '~icons/share/x';
1216
1317
export default {
1418
name: "SocialSharing",
19+
components: {
20+
IconBsky,
21+
IconEmail,
22+
IconMastodon,
23+
IconX
24+
},
1525
props: {
1626
text: {
1727
type: String,
@@ -58,29 +68,3 @@ export default {
5868
}
5969
};
6070
</script>
61-
62-
<style lang="scss" scoped>
63-
.service .svg {
64-
display: inline-block;
65-
vertical-align: sub;
66-
height: 1em;
67-
width: 1em;
68-
background-color: #fff;
69-
mask-size: 1em 1em;
70-
mask-repeat: no-repeat;
71-
mask-position: center;
72-
73-
&.email {
74-
mask-image: url('@/media/email.svg');
75-
}
76-
&.bsky {
77-
mask-image: url('@/media/bsky.svg');
78-
}
79-
&.mastodon {
80-
mask-image: url('@/media/mastodon.svg');
81-
}
82-
&.x {
83-
mask-image: url('@/media/x.svg');
84-
}
85-
}
86-
</style>

src/components/maps/MapSelect.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,5 +198,5 @@ export default {
198198
</script>
199199

200200
<style lang="scss">
201-
@import "../../../node_modules/ol/ol.css";
201+
@import "ol/ol.css";
202202
</style>

vue-svg-loader.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

vue.config.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const { hideBin } = require('yargs/helpers');
33
const path = require('path');
44
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin');
55
const Icons = require('unplugin-icons/webpack');
6+
const { FileSystemIconLoader } = require('unplugin-icons/loaders');
67
const Components = require('unplugin-vue-components/webpack');
78
const IconsResolver = require('unplugin-icons/resolver');
89
const { BootstrapVueNextResolver } = require('bootstrap-vue-next/resolvers');
@@ -55,7 +56,6 @@ const vueConfig = {
5556
args[0].STAC_BROWSER_VERSION = JSON.stringify(pkgFile.version);
5657
args[0].CONFIG_PATH = JSON.stringify(configFile);
5758
args[0].CONFIG_CLI = JSON.stringify(argv);
58-
args[0].__VUE_OPTIONS_API__ = true;
5959
return args;
6060
});
6161

@@ -110,12 +110,16 @@ const vueConfig = {
110110
enabledCollections: ['bi'],
111111
alias: {
112112
'b-icon': 'bi'
113-
}
113+
},
114+
customCollections: ['share'],
114115
})
115116
]
116117
}),
117118
Icons({
118119
compiler: 'vue3',
120+
customCollections: {
121+
'share': FileSystemIconLoader('./src/media/'),
122+
},
119123
}),
120124
]
121125
},

0 commit comments

Comments
 (0)