为 Javascript 编译 google libphonenumber

Compiling google libphonenumber for Javascript

我已按照此处的说明进行操作:https://github.com/googlei18n/libphonenumber/tree/master/javascript

但是,我 运行 遇到了这条线的麻烦:

Build Closure's compiler.jar: ant -f ~/src/closure-compiler/build.xml

我使用 git 克隆的闭包编译器文件中没有 build.xml

帮忙?

他们最近改用 Maven。 Ant 似乎不再受支持。请参阅 https://github.com/google/closure-compiler

"Building it Yourself" 下的说明

您也可以只从该页面下载最新版本的编译器,无需使用 ant 或 maven 进行构建。

如果您正在为网络编译它,我可能还建议您使用精简的纯 javascript 替代方案,它小于 100 KB(因为它是网络浏览器):

https://github.com/halt-hammerzeit/libphonenumber-js