Skip to content

Commit fb4621f

Browse files
Replace NodeJS methods with native javascript
Fixes rishabh3112#50 When fixing the path generation for "msapplication-TileImage" rishabh3112#48 NodeJS methods were used. This commit fixes the usage of NodeJS which is not available in the browser.
1 parent 3790e26 commit fb4621f

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

gridsome.client.js

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
const { parse } = require('path');
21
const { register } = require('register-service-worker');
32

43
const clientConfig = function (Vue, options, context) {
@@ -30,9 +29,17 @@ const clientConfig = function (Vue, options, context) {
3029
})
3130
}
3231

33-
const iconsDir = 'assets/static/';
34-
const iconPathParsed = parse(options.icon);
35-
const msTileImage = `/${iconsDir}${iconPathParsed.name}-144x144${iconPathParsed.ext}`;
32+
const iconsDir = '/assets/static/';
33+
const iconName = options.icon.split('/').slice(-1)[0];
34+
const iconNameDotIdx = iconName.lastIndexOf('.');
35+
36+
var msTileImage = iconsDir;
37+
38+
if(iconNameDotIdx > -1) {
39+
msTileImage += `${iconName.substring(0, iconNameDotIdx)}-144x144${iconName.substring(iconNameDotIdx)}`
40+
} else {
41+
msTileImage += `${iconName}-144x144`
42+
}
3643

3744
head.link.push({
3845
rel: 'manifest',

0 commit comments

Comments
 (0)