Reputation: 61
How to install vuetify in a project generated with quasar cli?
In a normal project with vue cli only need the command
vue add vuetify
but in quasar cli I run the command
npm install vuetify
and generate new boot file, but i have an error in sass or sass-loader
Upvotes: 6
Views: 3823
Reputation: 11
how to connect/use Vuetify 3 in Quasar 2
Connecting Vuetify
npm install vuetify
src/ui/index.js
import { createVuetify } from 'vuetify'
import 'vuetify/styles'
export const vuetifyInstance = createVuetify({/* ... */})
src/boot/registerVuetify.js
import { vuetifyInstance as vuetify } from 'src/ui'
export default ({ app }) => {
app.use(vuetify)
}
add to quasar.config.js
module.exports = configure(function (/*ctx*/) {
return {
//...
boot: [
//...
'~src/boot/registerVuetify'
],
//...
}
})
quasar.config.js
module.exports = configure(function( /*ctx*/ ) {
return {
//...
build: {
//...
extendViteConf(viteConf) {
viteConf.build.rollupOptions = {
output: {
// exclude quasar css framework (this does not completely exclude the framework from the final build)
manualChunks(path) {
if (/node_modules.*quasar/.test(path)) {
return null
}
},
},
},
},
//...
alias: {
'quasar/dist/quasar.css': path.join(__dirname, './src/assets/sass/_your_styles.sass'),
},
},
//...
framework: {
//...
cssAddon: false,
//...
},
}
})
Upvotes: 0
Reputation: 333
He did it, but he's a bit of a cheater. I needed a very fast migration to export a mobile app. Steps:
quasar dev
at least once.Enter node_modules\@quasar\app\lib\generator.js
and change
const paths = [
'app.js',
'client-entry.js',
'client-prefetch.js',
'import-quasar.js'
]
by
const paths = [
'client-entry.js',
'client-prefetch.js',
'import-quasar.js'
]
Install vuetify npm install vuetify
.quasar\app.js
and put your vuetify configuration, in my case:import es from "vuetify/src/locale/es"; import Vuetify from 'vuetify' import 'vuetify/dist/vuetify.min.css' const opts = { theme: { options: { customProperties: true }, themes: { light: { primary: "#F79DC2", secondary: "#02283c", accent: "#FFAB00", error: "#a13835", disabled: "#a13835", background: "black" } } }, lang: { locales: { es }, current: "es" } }; Vue.use(Vuetify)
Below you have to add
const vuetify = new Vuetify (opts) const app = { router, store, vuetify, <-------- render: h => h (App) }
<v-app id = "q-app"> . . </v-app>
Working! I hope it works!
Upvotes: 2
Reputation: 67
It, not a good idea to use two frontend UI frameworks like(bootstrap,vuetify, quasar ...) in one project, it's just like using honey and industrial sugar to make one tea.
what if vuetify comes with a cli, would you have added vuetify to quasar or quasar to vuetify
Upvotes: 1