반응형
Rails 5.1 app with Vue and webpacker 3, css not compiled
I'm trying to add Element UI to my Vue app. I follow the quick start tutorial and I have my application.js
import Vue from 'vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale/lang/it'
import App from '../app.vue'
Vue.use(ElementUI, { locale })
document.addEventListener('DOMContentLoaded', () => {
document.body.appendChild(document.createElement('app'))
const app = new Vue(App).$mount('app')
console.log(app)
})
I'm importing the CSS and I have also
<%= stylesheet_link_tag 'application' %>
Inside my layout, but this file is empty, no styles. The app is working, but without the CSS. Where is my fault?
The problem is in the import method
Use
<%= stylesheet_pack_tag 'application', media: 'all' %>
Instead of
<%= stylesheet_link_tag 'application' %>
based on: https://github.com/rails/webpacker/issues/987
ReferenceURL : https://stackoverflow.com/questions/47222784/rails-5-1-app-with-vue-and-webpacker-3-css-not-compiled
반응형
'programing' 카테고리의 다른 글
ReactNative 앱에서 EXPO_DEBUG 값을 설정하는 위치? (0) | 2022.04.08 |
---|---|
Vue.js에게 강제로 재장전/재장전할 수 있는가? (0) | 2022.04.08 |
로컬 컴퓨터 또는 웹 리소스에서 이미지 또는 그림을 주피터 노트북에 내장하는 방법 (0) | 2022.04.07 |
비즈니스 논리 및 데이터 액세스 분리(django) (0) | 2022.04.07 |
setState 없이 기능적인 Resact.js 구성 요소를 다시 렌더링할 수 있는 방법이 있는가? (0) | 2022.04.07 |