Skip to content

Commit

Permalink
fix: update opts parameter syntax
Browse files Browse the repository at this point in the history
options were not being properly applied to templates
  • Loading branch information
johnleider committed Nov 3, 2019
1 parent 2c02520 commit ca0a0b4
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 21 deletions.
2 changes: 1 addition & 1 deletion generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = (api, opts) => {
if (opts.installFonts) fonts.addDependencies(api, opts.iconFont)

// Update templates
vuetify.renderFiles(api, opts)
vuetify.renderFiles(api, { opts })

// adapted from https://github.com/Akryum/vue-cli-plugin-apollo/blob/master/generator/index.js#L68-L91
api.onCreateComplete(() => {
Expand Down
47 changes: 34 additions & 13 deletions generator/templates/default/src/App.js.vue
Original file line number Diff line number Diff line change
@@ -1,31 +1,52 @@
<template>
<v-app>
<v-app-bar app>
<v-toolbar-title class="headline text-uppercase">
<span>Vuetify</span>
<span class="font-weight-light">MATERIAL DESIGN</span>
</v-toolbar-title>
<v-app-bar
app
color="primary"
dark
>
<div class="d-flex align-center">
<v-img
alt="Vuetify Logo"
class="shrink mr-2"
contain
src="https://cdn.vuetifyjs.com/images/logos/vuetify-logo-dark.png"
transition="scale-transition"
width="40"
/>

<v-img
alt="Vuetify Name"
class="shrink mt-1 hidden-sm-and-down"
contain
min-width="100"
src="https://cdn.vuetifyjs.com/images/logos/vuetify-name-dark.png"
width="100"
/>
</div>

<v-spacer></v-spacer>

<v-btn
text
href="https://github.com/vuetifyjs/vuetify/releases/latest"
target="_blank"
text
>
<span class="mr-2">Latest Release</span>
<%_ if (options.iconFont === 'mdi') { _%>
<%_ if (opts.iconFont === 'mdi') { _%>
<v-icon>mdi-open-in-new</v-icon>
<%_ } else if (options.iconFont === 'md') { _%>
<%_ } else if (opts.iconFont === 'md') { _%>
<v-icon>open_in_new</v-icon>
<%_ } else if (options.iconFont === 'fa') { _%>
<%_ } else if (opts.iconFont === 'fa') { _%>
<v-icon>fas fa-external-link-alt</v-icon>
<%_ } else if (options.iconFont === 'fa4') { _%>
<%_ } else if (opts.iconFont === 'fa4') { _%>
<v-icon>fa-external-link</v-icon>
<%_ } _%>
</v-btn>
</v-app-bar>

<v-content>
<%_ if (options.router) { _%>
<%_ if (opts.router) { _%>
<router-view/>
<%_ } else { _%>
<HelloWorld/>
Expand All @@ -35,13 +56,13 @@
</template>

<script>
<%_ if (!options.router) { _%>
<%_ if (!opts.router) { _%>
import HelloWorld from './components/HelloWorld';
<%_ } _%>
export default {
name: 'App',
<%_ if (!options.router) { _%>
<%_ if (!opts.router) { _%>
components: {
HelloWorld,
},
Expand Down
14 changes: 7 additions & 7 deletions generator/templates/default/src/plugins/vuetify.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import Vue from 'vue';
<%_ if (useAlaCarte) { _%>
<%_ if (opts.useAlaCarte) { _%>
import Vuetify from 'vuetify/lib';
<%_ } else { _%>
import Vuetify from 'vuetify';
import 'vuetify/dist/vuetify.min.css';
<%_ } _%>
<%_ if (locale !== 'en') { _%>
<%_ if (opts.locale !== 'en') { _%>
import <%= locale.replace(/-/g, '') %> from 'vuetify/<%= typescript ? 'src' : 'es5' %>/locale/<%= locale %>';
<%_ } _%>
Vue.use(Vuetify);
export default new Vuetify({
<%_ if (useTheme) { _%>
<%_ if (opts.useTheme) { _%>
theme: {
<%_ if (useCustomProperties) { _%>
<%_ if (opts.useCustomProperties) { _%>
options: {
customProperties: true,
},
Expand All @@ -32,13 +32,13 @@ export default new Vuetify({
},
},
<%_ } _%>
<%_ if (locale !== 'en') { _%>
<%_ if (opts.locale !== 'en') { _%>
lang: {
locales: { <%= locale.replace(/-/g, '') %> },
locales: { <%= opts.locale.replace(/-/g, '') %> },
current: '<%= locale %>',
},
<%_ } _%>
icons: {
iconfont: '<%= iconFont %>',
iconfont: '<%= opts.iconFont %>',
},
});

0 comments on commit ca0a0b4

Please sign in to comment.