指南
- 介绍
- Contribute
- 部署
- 管理
- Advanced
进阶
- Main 核心概念
- 高级指引
- Advanced Guides
- Update Guides
- Extending Flarum
- Internal Team Docs
Extension Assets
Some extensions might want to include assets like images or JSON files in their source code (note that this is not the same as uploads, which would probably require a filesystem disk).
This is actually very easy to do. Just create an assets
folder at the root of your extension, and place any asset files there. Flarum will then automatically copy those files to its own assets
directory (or other storage location if one is offered by extensions) every time the extension is enabled or php flarum assets:publish
is executed.
If using the default storage driver, assets will be available at https://FORUM_URL/assets/extensions/EXTENSION_ID/file.path
. However, since other extensions might use remote filesystems, we recommend serializing the url to assets you need in the backend. See Flarum's serialization of the logo and favicon URLs for an example.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论