Vuetify css not applying in Heroku

人盡茶涼 提交于 2021-01-29 14:59:08

问题


I'm developing a rails app, that uses vue through webpacker. Inside of the vue app I import vuetify and vuetify.css like so:

import Vue from 'vue'
import Vuetify from 'vuetify'
import VueRouter from 'vue-router'
import 'vuetify/dist/vuetify.min.css'
import App from '../app.vue'
import Axios from 'axios'
import VueAxios from 'vue-axios'
import Vuex from 'vuex'

Works fine locally, but when pushed to heroku it no longer works. The app deploys, and it appears like vuetify is included, but the vuetify css is not. Why is this? Other css features are included. I tried importing vuetify css in my application.scss file like so, but no luck:

@import '~vuetify/src/vuetify.min.css';

@import '~node_modules/vuetify/dist/vuetify.min.css';

Further, I plan on decoupling the vue app from the rails app later, will this still be a problem then?


回答1:


You'll need to mostly follow the Webpack Instructions here - https://vuetifyjs.com/en/getting-started/installation/#webpack-install (but ignore installing the sass-loader, since that should be already in place).

yarn add vuetify

Add this at the top of your vuetify plugin:

import Vue from 'vue'
import Vuetify from 'vuetify/lib'

Remove:

@import '~vuetify/src/vuetify.min.css';

@import '~node_modules/vuetify/dist/vuetify.min.css';

import 'vuetify/dist/vuetify.min.css'

^ sass should pack the vuetify css



来源:https://stackoverflow.com/questions/65708053/vuetify-css-not-applying-in-heroku

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!