Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在 css 裡放 url(path/to/image.png) 會被冠上 css 的 public path #1

Closed
wesley100002001 opened this issue Jul 5, 2017 · 5 comments
Assignees

Comments

@wesley100002001
Copy link
Contributor

wesley100002001 commented Jul 5, 2017

本來該是 /static/img/xxx.png
會變成 /static/css/static/img/xxx.png
現在的 workaround 是把圖檔 encode 進 url 的檔案限制調大,從 10000 -> 100000
webpack.base.conf 檔案裡

use: [{
  loader: 'url-loader',
  options: {
    limit: 8192
  }
}]
@wesley100002001 wesley100002001 self-assigned this Jul 5, 2017
@chihaoyo
Copy link
Contributor

chihaoyo commented Jul 5, 2017

Found this: webpack-contrib/css-loader#256 about creating alias in webpack con gif & using ~ in CSS. Doesn’t help with this issue but nice to know.

@chihaoyo
Copy link
Contributor

chihaoyo commented Jul 6, 2017

“Handling static assets” for vue init webpack: https://vuejs-templates.github.io/webpack/static.html

@chihaoyo chihaoyo changed the title 在 Css 裡放 Url(.../xxx.png) 會被冠上 css 的 public path 在 css 裡放 url(path/to/image.png) 會被冠上 css 的 public path Jul 6, 2017
@chihaoyo
Copy link
Contributor

chihaoyo commented Jul 6, 2017

失敗的例子在這裡:https://ask-vue-webpack.watchout.tw/ 首頁大圖消失了 😢

@chihaoyo
Copy link
Contributor

chihaoyo commented Jul 6, 2017

暫時的解決方法:大圖放在跟 /src 平行的 /static 裡,CSS裡用 /static/path/to/image.png 這樣就不會被 *-loader parse。

@chihaoyo
Copy link
Contributor

chihaoyo commented Aug 10, 2017

先close好了 ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants