Skip to content

wepy2.0.x 图片素材打包问题:tabBar 配置中引用图片没有正确打包 #2200

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

Closed
hezzze opened this issue Jun 19, 2019 · 4 comments

Comments

@hezzze
Copy link

hezzze commented Jun 19, 2019


Description

好像只有代码 .wpy 中被引用的素材才会正确被打包进入编译后的路径,默认为 weapp/,wepy 1.x 没有这个问题。

案例1:

比如说如果我的代码里有一段动态的素材引用:

<image src="../images/pic-{{n}}.png"></image>

相关的素材 pic-1.png, pic-2.png, pic-3.png 都没有被打包到最终的 weapp 文件夹下

案例2:

如下 app.wpy 中tabBar 配置,引用过的icon.png 以及 icon-selected.png 没有正确被复制到对应的输出文件夹(weapp/)

<config>
{
...
tabBar: {
  color: '#7A7E83',
  selectedColor: '#32c1ba',
  borderStyle: 'black',
  backgroundColor: '#ffffff',
  list: [
    {
      pagePath: 'pages/p1',
      iconPath: 'images/icon.png',
      selectedIconPath: 'images/icon-selected.png',
      text: 'page1'
    }
  ]
}
...
}
</config>
 ```
@zhuman90
Copy link

确实有这个问题,我的tabbar引入的图标也没有被打包

@dlhandsome
Copy link
Collaborator

可以在 wepy.config.js 中配置 static 路径:

module.exports = {
  wpyExt: '.wpy',
 static: ['./src/images']
}

@zhuman90
Copy link

可以在 wepy.config.js 中配置 static 路径:

module.exports = {
  wpyExt: '.wpy',
 static: ['./src/images']
}

管用,老哥

Gcaufy referenced this issue in wepyjs/wepy-docs Jun 22, 2019
@Gcaufy
Copy link
Collaborator

Gcaufy commented Jun 22, 2019

已在文档中添加说明

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

4 participants