Moved from vuejs/vue#7400
Basically today I noticed that webpack aliases work properly for import statements, however not with section of .vue component. Example given: '@': './src' alias works fine with import smth from '@/smth' in section, but when i tried this: <style> .jumbotron { background: url('@/assets/images/welcome.jpg') center / cover; } </style> it failed, I thought it would be great to be able to write code this way, so Component.vue works even if its location changes. That would be super cool. Btw I love Vue, thanks a lot for a great work!
**webpack aliases for .vue section
<style> .jumbotron { background: url('@/assets/images/welcome.jpg') center / cover; } </style>
Pulled a request #1139
Well... I just realized you can already do that with (prefix the url with ~)
<style>
.jumbotron {
background: url('~@/assets/images/welcome.jpg') center / cover;
}
</style>
So extra processing in vue-loader is not really necessary.
This does not work when image link is specified in inline style attribute as in vuejs/vue-cli#928
I confirm.
Inline style background images do not work.
Using cli v3.0.0-beta.11
Most helpful comment
Well... I just realized you can already do that with (prefix the url with
~)So extra processing in
vue-loaderis not really necessary.