PhoneGap的 - 自动包括正确科尔多瓦 [英] Phonegap - automatically including correct cordova

查看:125
本文介绍了PhoneGap的 - 自动包括正确科尔多瓦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发的iOS和Android的一个PhoneGap的应用程序,有我的www目录版本控制,Git的。我知道我的HTML文件必须包含正确的Cordova.js文件(取决于哪个平台我目前正在开发的)。

I'm developing a phonegap app on both iOS and android and have my www directory version controlled with git. I know that my HTML file needs to include the correct Cordova.js file (depending on which platform I'm currently developing on).

这是一个有点恼人的拉动变化到www iOS上,当有人正在研究机器人。它给了我无尽的gap_poll警报。

It is a little annoying pulling changes to www on iOS when someone was working on android. It gives me the endless gap_poll alert.

简单的解决方案是要记住改变Cordova.js SRC因此它指向的iOS版本了。这问题是其他开发人员需要不断地改变自己的SRC如果最新提交在其它平台上完成的。

Simple solution is to remember to change the Cordova.js src so it points to the iOS version again. The problem with that is the other developers will need to keep changing their src if the latest commit was done on another platform.

有没有一种方法来自动检测包含哪些科尔多瓦的版本?这样,它的工作在任何平台上,我们就不必进行繁琐的变化。

Is there a way to automatically detect which version of Cordova to include? That way it would work on any platform and we wouldn't have to make tedious changes.

推荐答案

我有同样的设置与我共享的HTML / JS作为Git的子模块。我的index.html坐落在共享文件夹中,并使用相对路径包括特定于平台的JS文件。

I have the same setup with my shared HTML/JS as a Git sub-module. My index.html sits in the shared folder and includes the platform-specific JS files using a relative path.

有3 Git的项目 - 安卓,iOS和共享。共享添加为一个子模块的Andr​​oid和iOS。

There are 3 Git projects - Android, iOS and Shared. Shared is added as a sub-module in Android and iOS.

文件夹结构

www
|-platform
    |-js/libs/cordova.js
|-shared
    |-index.html

和index.html中

And in index.html

<script type="text/javascript" src="../platform/js/libs/cordova.js"></script>

我用同样的主意,包括JS文件的插件这也是依赖于平台。

I use the same idea to include JS files for plugins which are also platform dependant.

这篇关于PhoneGap的 - 自动包括正确科尔多瓦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆