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

Commit 4eb7b01

Browse files
feat: generate vuetify.ts if typescript
1 parent 5b28285 commit 4eb7b01

File tree

3 files changed

+52
-4
lines changed

3 files changed

+52
-4
lines changed

generator/helpers.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ const fs = require('fs')
33
module.exports = function (api) {
44
return {
55
getMain() {
6-
const tsPath = api.resolve('src/main.ts')
7-
8-
return fs.existsSync(tsPath) ? 'src/main.ts' : 'src/main.js'
6+
return api.hasPlugin('typescript')
7+
? api.resolve('src/main.ts')
8+
: api.resolve('src/main.ts')
99
},
1010

1111
updateBabelConfig (callback) {

generator/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ module.exports = (api, opts, rootOpts) => {
4444

4545

4646
// Render vuetify plugin file
47-
api.render({
47+
api.render(api.hasPlugin('typescript') ? {
48+
'./src/plugins/vuetify.ts': './templates/default/src/plugins/vuetify.ts'
49+
} : {
4850
'./src/plugins/vuetify.js': './templates/default/src/plugins/vuetify.js'
4951
}, opts)
5052

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import Vue from 'vue'
2+
<%_ if (options.useAlaCarte) { _%>
3+
import {
4+
Vuetify,
5+
VApp,
6+
VNavigationDrawer,
7+
VFooter,
8+
VList,
9+
VBtn,
10+
VIcon,
11+
VGrid,
12+
VToolbar,
13+
transitions
14+
} from 'vuetify'
15+
import 'vuetify/src/stylus/app.styl'
16+
<%_ } else { _%>
17+
import Vuetify from 'vuetify'
18+
import 'vuetify/dist/vuetify.min.css'
19+
<%_ } _%>
20+
21+
Vue.use(Vuetify, {
22+
<%_ if (options.useAlaCarte) { _%>
23+
components: {
24+
VApp,
25+
VNavigationDrawer,
26+
VFooter,
27+
VList,
28+
VBtn,
29+
VIcon,
30+
VGrid,
31+
VToolbar,
32+
transitions
33+
},
34+
<%_ } _%>
35+
<%_ if (options.useTheme) { _%>
36+
theme: {
37+
primary: '#ee44aa',
38+
secondary: '#424242',
39+
accent: '#82B1FF',
40+
error: '#FF5252',
41+
info: '#2196F3',
42+
success: '#4CAF50',
43+
warning: '#FFC107'
44+
},
45+
<%_ } _%>
46+
})

0 commit comments

Comments
 (0)