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

sass中本地图片的引用问题 #32

Open
xilin opened this issue Aug 9, 2018 · 5 comments
Open

sass中本地图片的引用问题 #32

xilin opened this issue Aug 9, 2018 · 5 comments

Comments

@xilin
Copy link

xilin commented Aug 9, 2018

请教一下要如何配置url-loader才能让sass中用url引用图片时能自动处理成base64数据呢?

@Cap32
Copy link
Member

Cap32 commented Aug 28, 2018

url-loader 替代 file-loader。具体用法见 url-loader 文档呗

@Cap32 Cap32 closed this as completed Aug 28, 2018
@xilin
Copy link
Author

xilin commented Aug 31, 2018

我试了一下,加了rule保证过滤图片,但是url-loader完全无视sass里的图片url,没有转换

@Cap32 Cap32 reopened this Aug 31, 2018
@anota
Copy link

anota commented Sep 21, 2018

同有这个问题 wxml中 url-loader可以转成base64,在sass文件就无法转换 换成base64-inline-loader也一样

@anota
Copy link

anota commented Sep 24, 2018

最近再看了下webpack的配置,如果sass文件需要转成base64,需要再引入css-loader,而且小程序是多页面应用,需要再另外引入插件extract-text-webpack-plugin。这样就ok了。

@xilin
Copy link
Author

xilin commented Sep 25, 2018

@anota 可以贴一下配置吗?ExtractTextPlugin的输出写成固定的wxss文件吗?

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

3 participants