简体   繁体   English

如何使用混合包运送非Elixir文件?

[英]How to ship non-elixir files with mix package?

I'm building a library in Elixir which processes XML-files of some kind. 我正在Elixir中建立一个可处理某种XML文件的库。 I'd like to ship DTD schema with it, cause that XML-files refer to it inside of <!DOCTYPE> . 我想将它附带DTD模式,因为XML文件在<!DOCTYPE>内引用了它。 How do I do so that it all worked being imported by another app. 我该怎么做,以确保所有其他应用程序都可以导入所有内容。

Generalizing: how do I ship some static non-elixir files (resources) that are being used by mix project? 概括:如何传送混合项目正在使用的一些静态非elixir文件(资源)?

The usual place to put non-source code files that are required at runtime is the /priv directory at the root of the package alongside /lib or /config . 通常的地方把所需在运行时非源代码文件是/priv在封装并排的根目录/lib/config The compiler maintains the proper references and makes sure the directory is always available in the appropriate place when accessed through: 编译器维护适当的引用,并确保在通过以下方式访问目录时,该目录始终在适当的位置可用:

Application.app_dir(:my_app, "priv/path/to/file")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM