Skip to content

Commit 47bd442

Browse files
authored
Use svg as vue components (#8)
* Install the svg-to-vue-component package * Configure webpack for vue-svg-loader * Use menu icon as SVG component * Change footer png icons to SVG * Update features icons to SVG * Move icons to icon directory * Add discord logo in SVG format * Use "vue-svg-loader" instead of "svg-to-vue-component"
1 parent 1c35b86 commit 47bd442

18 files changed

+69
-13
lines changed

gridsome.config.js

+8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@ module.exports = {
33
siteUrl: 'https://thermal.codecarrot.net/',
44
titleTemplate: "%s | Thermal",
55

6+
chainWebpack: config => {
7+
const svgRule = config.module.rule('svg')
8+
svgRule.uses.clear()
9+
svgRule
10+
.use('vue-svg-loader')
11+
.loader('vue-svg-loader')
12+
},
13+
614
plugins: [
715
{
816
use: '@gridsome/plugin-google-analytics',

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"@gridsome/transformer-remark": "^0.3.1",
3131
"node-sass": "^4.12.0",
3232
"platform": "^1.3.5",
33-
"sass-loader": "^7.1.0"
33+
"sass-loader": "^7.1.0",
34+
"vue-svg-loader": "^0.12.0"
3435
}
3536
}

src/components/Footer.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@
3333

3434
<div class="footer__social">
3535
<a href="https://www.github.com/gitthermal/thermal" class="footer__social-item">
36-
<g-image src="../../static/images/github-4x.png" />
36+
<g-image src="../../static/images/icon/github.svg" />
3737
</a>
3838
<a href="https://discord.gg/KT3nAR5" class="footer__social-item">
39-
<g-image src="../../static/images/discord-4x.png" />
39+
<g-image src="../../static/images/icon/discord.svg" />
4040
</a>
4141
<a href="https://www.producthunt.com/posts/thermal" class="footer__social-item">
42-
<g-image src="../../static/images/producthunt-4x.png" />
42+
<g-image src="../../static/images/icon/producthunt.svg" />
4343
</a>
4444
<a href="https://www.twitter.com/gitthermal" class="footer__social-item">
45-
<g-image src="../../static/images/twitter-4x.png" />
45+
<g-image src="../../static/images/icon/twitter.svg" />
4646
</a>
4747
</div>
4848

src/components/Header.vue

+3-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
@click="navbarToggle()"
5151
class="header__navbar-menu"
5252
>
53-
<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24" width="24" height="24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12h18M3 6h18M3 18h18"/></svg>
53+
<MenuIcon />
5454
</div>
5555
</div>
5656
</Container>
@@ -60,6 +60,7 @@
6060
<script>
6161
import Container from "../layouts/Container";
6262
import Logo from "./Logo";
63+
import MenuIcon from "../../static/images/icon/menu.svg"
6364
import OutlineButton from "./Button/OutlineButton"
6465
import DownloadMixin from "../mixins/download"
6566
@@ -75,6 +76,7 @@ export default {
7576
components: {
7677
Container,
7778
Logo,
79+
MenuIcon,
7880
OutlineButton
7981
},
8082
props: {

src/pages/Download.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,21 @@
1919
<div class="download__other-list">
2020
<div class="download__other-item">
2121
<g-image
22-
src="../../static/images/windows.svg"
22+
src="../../static/images/icon/windows.svg"
2323
class="download__other-image"
2424
/>
2525
<h4>Windows</h4>
2626
</div>
2727
<div class="download__other-item">
2828
<g-image
29-
src="../../static/images/mac.png"
29+
src="../../static/images/icon/mac.png"
3030
class="download__other-image"
3131
/>
3232
<h4>MacOS</h4>
3333
</div>
3434
<div class="download__other-item">
3535
<g-image
36-
src="../../static/images/linux.svg"
36+
src="../../static/images/icon/linux.svg"
3737
class="download__other-image"
3838
/>
3939
<h4>Linux</h4>

src/pages/Index.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
<container>
6262
<div class="index__features-container">
6363
<div class="index__features-item">
64-
<g-image src="../../static/images/open-source-2x.png" class="index__features-icon" />
64+
<g-image src="../../static/images/icon/open-source.svg" class="index__features-icon" />
6565
<div class="index__features-heading">
6666
Open Source
6767
</div>
@@ -70,7 +70,7 @@
7070
</div>
7171
</div>
7272
<div class="index__features-item">
73-
<g-image src="../../static/images/easy-to-use-2x.png" class="index__features-icon" />
73+
<g-image src="../../static/images/icon/easy-to-use.svg" class="index__features-icon" />
7474
<div class="index__features-heading">
7575
Easy to use
7676
</div>
@@ -79,7 +79,7 @@
7979
</div>
8080
</div>
8181
<div class="index__features-item">
82-
<g-image src="../../static/images/multi-os-2x.png" class="index__features-icon" />
82+
<g-image src="../../static/images/icon/multi-os.svg" class="index__features-icon" />
8383
<div class="index__features-heading">
8484
Cross platform
8585
</div>

static/images/icon/discord.svg

+5
Loading

static/images/icon/easy-to-use.svg

+6
Loading

static/images/icon/github.svg

+3
Loading
File renamed without changes.
File renamed without changes.

static/images/icon/menu.svg

+1
Loading

static/images/icon/multi-os.svg

+6
Loading

static/images/icon/open-source.svg

+3
Loading

static/images/icon/producthunt.svg

+3
Loading

static/images/icon/twitter.svg

+3
Loading
File renamed without changes.

yarn.lock

+16-1
Original file line numberDiff line numberDiff line change
@@ -8006,7 +8006,14 @@ svg-tags@^1.0.0:
80068006
resolved "https://registry.yarnpkg.com/svg-tags/-/svg-tags-1.0.0.tgz#58f71cee3bd519b59d4b2a843b6c7de64ac04764"
80078007
integrity sha1-WPcc7jvVGbWdSyqEO2x95krAR2Q=
80088008

8009-
svgo@^1.0.0:
8009+
svg-to-vue@^0.4.0:
8010+
version "0.4.0"
8011+
resolved "https://registry.yarnpkg.com/svg-to-vue/-/svg-to-vue-0.4.0.tgz#93a2fc9658c09593f6099ac7f5ded73ac83dc549"
8012+
integrity sha512-g/ZHtEFf4QDsDtTk9tuYX/MJ2HESTUBMTkuLoffQGQ3xMtlmD9Ec4YyTgmMkP1P8QJtWWu2FiGdOnlKaXc/X/Q==
8013+
dependencies:
8014+
svgo "^1.1.1"
8015+
8016+
svgo@^1.0.0, svgo@^1.1.1:
80108017
version "1.2.2"
80118018
resolved "https://registry.yarnpkg.com/svgo/-/svgo-1.2.2.tgz#0253d34eccf2aed4ad4f283e11ee75198f9d7316"
80128019
integrity sha512-rAfulcwp2D9jjdGu+0CuqlrAUin6bBWrpoqXWwKDZZZJfXcUXQSxLJOFJCQCSA0x0pP2U0TxSlJu2ROq5Bq6qA==
@@ -8743,6 +8750,14 @@ vue-style-loader@^4.1.0:
87438750
hash-sum "^1.0.2"
87448751
loader-utils "^1.0.2"
87458752

8753+
vue-svg-loader@^0.12.0:
8754+
version "0.12.0"
8755+
resolved "https://registry.yarnpkg.com/vue-svg-loader/-/vue-svg-loader-0.12.0.tgz#5ea97d021edd3023236b92f96c3aba433b5d428b"
8756+
integrity sha512-pg8H6iKCj+DAC7FZuxdfGJMHiFpJPv/YyoN1M7Iqlf+Hu4eU6Q/W/sEFx978syQA+aOx0NXrp+uQUAajqQvXbQ==
8757+
dependencies:
8758+
loader-utils "^1.2.3"
8759+
svg-to-vue "^0.4.0"
8760+
87468761
vue-template-compiler@^2.6.10:
87478762
version "2.6.10"
87488763
resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.6.10.tgz#323b4f3495f04faa3503337a82f5d6507799c9cc"

0 commit comments

Comments
 (0)