Skip to content
This repository was archived by the owner on May 8, 2025. It is now read-only.

Commit fce347a

Browse files
committed
Merge branch 'dev'
2 parents 88bdb31 + 6c1a37a commit fce347a

File tree

4 files changed

+29
-5
lines changed

4 files changed

+29
-5
lines changed

generator/helpers.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ const fs = require('fs')
22

33
module.exports = function (api) {
44
return {
5+
getMain() {
6+
const tsPath = api.resolve('src/main.ts')
7+
8+
return fs.existsSync(tsPath) ? 'src/main.ts' : 'src/main.js'
9+
},
10+
511
updateBabelConfig (callback) {
612
let config, configPath
713

generator/index.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,24 @@ module.exports = (api, opts, rootOpts) => {
2525
})
2626
}
2727

28+
if (api.hasPlugin('electron-builder') === true) {
29+
// material icons pkg for electron
30+
api.extendPackage({
31+
devDependencies: {
32+
"material-design-icons-iconfont": "^3.0.3",
33+
}
34+
})
35+
36+
try {
37+
api.injectImports(helpers.getMain(),
38+
`import 'material-design-icons-iconfont/dist/material-design-icons.css'`
39+
)
40+
} catch(e) {
41+
console.error(e)
42+
}
43+
}
44+
45+
2846
// Render vuetify plugin file
2947
api.render({
3048
'./src/plugins/vuetify.js': './templates/default/src/plugins/vuetify.js'
@@ -115,16 +133,16 @@ module.exports = (api, opts, rootOpts) => {
115133
})
116134
}
117135

118-
// Add Material Icons
119-
{
136+
// Add Material Icons (unless electron)
137+
if(api.hasPlugin('electron-builder') === false) {
120138
const indexPath = api.resolve('./public/index.html')
121139

122140
let content = fs.readFileSync(indexPath, { encoding: 'utf8' })
123141

124142
const lines = content.split(/\r?\n/g).reverse()
125143

126144
const lastLink = lines.findIndex(line => line.match(/^\s*<link/))
127-
lines[lastLink] += '\n\t\t<link href="https://fonts.googleapis.com/css?family=Roboto:100:300,400,500,700,900|Material+Icons" rel="stylesheet">'
145+
lines[lastLink] += '\n <link href="https://fonts.googleapis.com/css?family=Roboto:100:300,400,500,700,900|Material+Icons" rel="stylesheet">'
128146

129147
content = lines.reverse().join('\n')
130148
fs.writeFileSync(indexPath, content, { encoding: 'utf8' })

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-cli-plugin-vuetify",
3-
"version": "0.1.5",
3+
"version": "0.1.6",
44
"description": "Plugin for vue cli 3",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)