Skip to content

Commit e9b4593

Browse files
committed
Fix OpenGraph icon, OG does not support SVG
1 parent 037d462 commit e9b4593

File tree

9 files changed

+41
-10
lines changed

9 files changed

+41
-10
lines changed

build/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ exports.createNotifierCallback = () => {
9595
title: packageConfig.name,
9696
message: severity + ': ' + error.name,
9797
subtitle: filename || '',
98-
icon: path.join(__dirname, 'static/icon.svg')
98+
icon: path.join(__dirname, '../src/assets/logo.svg')
9999
})
100100
}
101101
}

build/webpack.dev.conf.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
'use strict'
2+
const svg2png = require('svg2png')
23
const utils = require('./utils')
34
const webpack = require('webpack')
45
const config = require('../config')
@@ -53,7 +54,7 @@ const devWebpackConfig = merge(baseWebpackConfig, {
5354
new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
5455
new webpack.NoEmitOnErrorsPlugin(),
5556
new AppManifestWebpackPlugin({
56-
logo: path.resolve(__dirname, '../static/icon.svg'),
57+
logo: path.resolve(__dirname, '../src/assets/logo.svg'),
5758
prefix: '.',
5859
output: '/static/icons-[hash:8]/',
5960
inject: true,
@@ -77,9 +78,16 @@ const devWebpackConfig = merge(baseWebpackConfig, {
7778
new CopyWebpackPlugin([
7879
{
7980
from: path.resolve(__dirname, '../static'),
80-
to: config.dev.assetsSubDirectory,
81+
to: config.build.assetsSubDirectory,
8182
ignore: ['.*']
8283
},
84+
{
85+
from: path.resolve(__dirname, '../src/assets/logo.svg'),
86+
to: path.join(config.build.assetsSubDirectory, 'ogIcon.png'),
87+
transform (content, path) {
88+
return Promise.resolve(svg2png(content, { width: 400, height: 400 }));
89+
}
90+
},
8391
{
8492
from: path.resolve(__dirname, '../humans.txt'),
8593
to: config.build.assetsRoot,

build/webpack.prod.conf.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict'
22
const path = require('path')
3+
const svg2png = require('svg2png')
34
const utils = require('./utils')
45
const webpack = require('webpack')
56
const config = require('../config')
@@ -59,7 +60,7 @@ const webpackConfig = merge(baseWebpackConfig, {
5960
: { safe: true }
6061
}),
6162
new AppManifestWebpackPlugin({
62-
logo: path.resolve(__dirname, '../static/icon.svg'),
63+
logo: path.resolve(__dirname, '../src/assets/logo.svg'),
6364
prefix: '.',
6465
output: '/static/icons-[hash:8]/',
6566
inject: true,
@@ -132,6 +133,13 @@ const webpackConfig = merge(baseWebpackConfig, {
132133
to: config.build.assetsSubDirectory,
133134
ignore: ['.*']
134135
},
136+
{
137+
from: path.resolve(__dirname, '../src/assets/logo.svg'),
138+
to: path.join(config.build.assetsSubDirectory, 'ogIcon.png'),
139+
transform (content, path) {
140+
return Promise.resolve(svg2png(content, { width: 400, height: 400 }));
141+
}
142+
},
135143
{
136144
from: path.resolve(__dirname, '../humans.txt'),
137145
to: config.build.assetsRoot,

config/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,6 @@ module.exports = {
7575

7676
// OpenGraph-related variables
7777
ogURL: 'https://cyclo.phyks.me',
78-
ogImage: 'https://cyclo.phyks.me/static/icon.svg',
78+
ogImage: 'https://cyclo.phyks.me/static/ogIcon.png',
7979
}
8080
}

index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<!DOCTYPE html>
2-
<html lang="en">
2+
<html lang="en" prefix="og: http://ogp.me/ns#">
33
<head>
44
<meta charset="utf-8">
55
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0">
66

77
<meta name="description" content="Track and share issues (work, interruption in routes, parked cars) on bike lanes in realtime!">
88
<meta name="twitter:card" content="summary" />
99
<meta name="twitter:creator" content="@PhyksIsHere" />
10+
<meta property="og:type" content="website" />
1011
<meta property="og:title" content="Cyclassist: your bike companion!" />
1112
<meta property="og:description" content="Track and share issues (work, interruption in routes, parked cars) on bike lanes in realtime!" />
1213
<meta property="og:url" content="<%= htmlWebpackPlugin.options.ogURL %>" />

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
"build": "node build/build.js"
1212
},
1313
"dependencies": {
14-
"app-manifest-webpack-plugin": "^1.1.3",
1514
"es6-promise": "^4.2.4",
1615
"isomorphic-fetch": "^2.2.1",
1716
"leaflet": "^1.3.1",
@@ -29,6 +28,7 @@
2928
"vuex": "^3.0.1"
3029
},
3130
"devDependencies": {
31+
"app-manifest-webpack-plugin": "^1.1.3",
3232
"autoprefixer": "^7.1.2",
3333
"babel-core": "^6.22.1",
3434
"babel-eslint": "^7.1.1",
@@ -63,6 +63,7 @@
6363
"rimraf": "^2.6.0",
6464
"semver": "^5.3.0",
6565
"shelljs": "^0.7.6",
66+
"svg2png": "^4.1.1",
6667
"uglifyjs-webpack-plugin": "^1.1.1",
6768
"url-loader": "^0.5.8",
6869
"vue-loader": "^13.3.0",
File renamed without changes.

src/views/Map.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<v-container fluid fill-height class="no-padding">
33
<v-layout v-if="isIntro" row wrap class="text-xs-center blue lighten-2">
44
<v-flex xs8 offset-xs2>
5-
<p><img src="static/icon.svg" alt="Logo"/></p></p>
5+
<p><img src="@/assets/logo.svg" alt="Logo"/></p></p>
66
<p>{{ $t('about.summary') }}</p>
77
<v-btn role="button" round color="green" dark @click="introButtonClick">{{ $t('intro.start') }}</v-btn>
88
</v-flex>

yarn.lock

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2648,6 +2648,10 @@ file-type@^3.1.0, file-type@^3.8.0:
26482648
version "3.9.0"
26492649
resolved "https://registry.yarnpkg.com/file-type/-/file-type-3.9.0.tgz#257a078384d1db8087bc449d107d52a52672b9e9"
26502650

2651+
file-url@^2.0.0:
2652+
version "2.0.2"
2653+
resolved "https://registry.yarnpkg.com/file-url/-/file-url-2.0.2.tgz#e951784d79095127d3713029ab063f40818ca2ae"
2654+
26512655
filename-regex@^2.0.0:
26522656
version "2.0.1"
26532657
resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26"
@@ -4815,7 +4819,7 @@ performance-now@^2.1.0:
48154819
version "2.1.0"
48164820
resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
48174821

4818-
phantomjs-prebuilt@^2.1.10:
4822+
phantomjs-prebuilt@^2.1.10, phantomjs-prebuilt@^2.1.14:
48194823
version "2.1.16"
48204824
resolved "https://registry.yarnpkg.com/phantomjs-prebuilt/-/phantomjs-prebuilt-2.1.16.tgz#efd212a4a3966d3647684ea8ba788549be2aefef"
48214825
dependencies:
@@ -6183,6 +6187,15 @@ supports-color@^5.1.0, supports-color@^5.3.0, supports-color@^5.4.0:
61836187
dependencies:
61846188
has-flag "^3.0.0"
61856189

6190+
svg2png@^4.1.1:
6191+
version "4.1.1"
6192+
resolved "https://registry.yarnpkg.com/svg2png/-/svg2png-4.1.1.tgz#6b9e0398aa418778b6436e127a2fb7f00d499c28"
6193+
dependencies:
6194+
file-url "^2.0.0"
6195+
phantomjs-prebuilt "^2.1.14"
6196+
pn "^1.0.0"
6197+
yargs "^6.5.0"
6198+
61866199
svg2png@~3.0.1:
61876200
version "3.0.1"
61886201
resolved "https://registry.yarnpkg.com/svg2png/-/svg2png-3.0.1.tgz#a2644d68b0231ac00af431aa163714ff17106447"
@@ -6940,7 +6953,7 @@ yargs-parser@^7.0.0:
69406953
dependencies:
69416954
camelcase "^4.1.0"
69426955

6943-
6956+
[email protected], yargs@^6.5.0:
69446957
version "6.6.0"
69456958
resolved "https://registry.yarnpkg.com/yargs/-/yargs-6.6.0.tgz#782ec21ef403345f830a808ca3d513af56065208"
69466959
dependencies:

0 commit comments

Comments
 (0)