- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是 PhoneGap 的新手(版本:3.4)。目前我的项目结构如下:
.cordova
+---config.json
hooks
+---README.md
merges
+---android
+---js
+---index.js
platforms
+---.gitkeep
plugins
+---org.apache.cordova.device (content: the plugin sources, doc, and data)
+---android.json (content: plugins config for android)
www
+---css (content: many assets here)
+---img (content: many assets here)
+---js (content: many assets here, siblings of index.js)
+---index.js (a default file intended to be overriden by the merged index.js file)
+---res (content: resources for splashscreen and stuff configured in config.xml)
+---index.html
+---config.xml
+---icon.png
我的目的是让许多文件被平台特定文件(在本例中为 android)覆盖,因此我为自定义 Android Assets 创建了一个 merges/android
目录。
index.js 的内容(基础):
var app = {
selectDevice: function() {
window.alert('using default');
},
initialize: function() {
document.addEventListener("deviceready", this.selectDevice, false);
}
};
index.js 的内容(要合并):
var app = {
selectDevice: function() {
window.alert('using android');
},
initialize: function() {
document.addEventListener("deviceready", this.selectDevice, false);
}
};
index.html 的内容(每个平台唯一且通用的 html 文件):
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<script type="text/javascript" src="phonegap.js"></script>
<title>1001Carros</title>
</head>
<body>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript">
window.alert('initializing...');
app.initialize();
window.alert('initialization was run.');
</script>
<div id="log">
<button id="clickme" value="Click Me"></button>
pantalla principal
</div>
</body>
</html>
我在这里详细介绍的文件系统结构是我当前存储库的状态(注意:空文件夹具有虚拟 .gitkeep 文件,因此它们存在于存储库中 - 对于当前为空的平台目录尤其如此)。
但是,当我将内容推送到我的存储库并在 http://build.phonegap.com 中进行拉取和重建时,我有两种情况:
index.js
文件,而是在 merges/android 目录中创建。结果:文件丢失(即它的内容,这是在 deviceReady 事件中显示的警报 - 告诉当前平台是 android - 从未执行,后续代码也没有执行 - 消息:初始化已运行 - 这是结果尝试调用 app.initialize()
时出现 ReferenceError
)。index.js
创建为 www/js
下的默认值。结果:打印的消息是“使用默认值”。我的结论:该文件从未合并。
我的问题:为什么?我是否应该创建一个显式的platforms/android目录(好吧:platform)以便合并我的文件?或者当我告诉重建 Android 应用程序时,build.phonegap.com 应该自动执行此操作吗?
我在这里缺少什么?
最佳答案
merges
文件夹适用于图像或 css 等资源,在我看来,不适用于整个 JS。相反,我建议您添加设备插件并针对“android”测试 device.platform
在这些平台上的不同行为。
http://docs.phonegap.com/en/3.0.0/cordova_device_device.md.html#device.platform
您询问是否应该创建 platform/android
目录。这是一个奇怪的问题,因为如果你做得正确,你应该使用 build
命令,并且该目录应该由它自己创建!然后在 platform/android/assets/www
中,您应该会发现您的文件已合并,而不是其他地方。
关于cordova - Phonegap 合并目录 - Assets 未合并,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24540972/
我正在为我的程序编写安装脚本,它应该在 Linux/Unix 操作系统上运行。以下文件的默认目录是什么: 可执行文件(程序)。程序应通过从命令行键入其名称来执行。 共享库。 第三方共享库(程序未开源,
我有一堆用户、组和应用程序注册,我的 MVC 应用程序使用 AAD 数据进行身份验证和授权。是否可以将 Azure Active Directory 从一个租户(目录)迁移到另一个租户(目录)?如果可
查看 cljsbuild 文档 https://github.com/emezeske/lein-cljsbuild :cljsbuild { :builds [{ ; The
忽略已经版本控制的文件 如果你不小心添加了一些应该被忽略的文件,你如何将它们从版本控制中去除而不会丢失它们?或许你有自己的IDE配置文件,不是项目的一部分,但将会花费很多时间使之按照自己的方式工作。
我想使用\tableofcontents 命令,但没有目录从新页面开始或在末尾创建新页面,并且所有内容都是单倍行距。我怎样才能做到这一点?我假设使用 tocloft,但有哪些选择? 谢谢 最佳答案 试
我有一些 javascript 菜单代码,可以在单独的目录中正常工作。但是,当我尝试从同一目录中调用相同的 .js 文件时,它不会看到这些文件。 以下内容来自另一个目录: script type="t
我有这样的路径: /my/path/to/important_folder 在同一级别上,我还有其他文件和文件夹想要在达到与 important_folder 相同的级别时列出。 我的文件夹可能更深,
1、获取文件路径实现 1.1 获取当前文件路径 ? 1
我正在使用最新版本的 NTEmacs。 我写了一个名为“.dir-locals.el”的文件,如下所示。 ((nil . ((tab-width . 8) (fill-column .
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 7年前关闭。 Improve thi
在我的 .vimrc 中有这些行 :set foldmethod=marker :set foldmarker=SECTION:,ENDSECTION: 用于自定义代码折叠。在我的文件中,相关语言的注
在 fish 中: for x in * echo $x end *这里包括所有目录和文件,如何只列出文件(或目录)? 最佳答案 fish 没有很多花哨的通配语法。但是,目录可以像这样迭代: f
这是我的目录结构: ├── src │ ├── helpers │ │ ├── __init__.py │ │ ├── foo.py │ │ └── bar.py │
我想递归重命名文件夹/目录名称并找到 this solution所以。但是这个命令没有效果 find . -type f -exec rename 's/old/new/' '{}' \; 这是一个正
我想在相册中创建一个文件夹,并希望将图像保存在创建的相册中。 这可能吗?有什么办法可以做到这一点吗? 我已经搜索过,大多数人都说这是不可能的。 感谢您的帮助。 最佳答案 您也许可以使用AssetsLi
如何在python中使用用户定义的名称创建临时文件/目录。我知道 tempfile .但是我看不到任何以文件名作为参数的函数。 注意:我需要这个来对包含临时文件的临时目录上的 glob(文件名模式匹配
我在项目中使用JaCoCo Gradle插件。 作为问题的一个示例,我的大部分代码都在com.me.mysoftware包下。 我正在使用代码生成器来生成build/generated/java/..
我正在尝试使用 Gradle 开始运行 jar 文件 我的任务如下所示: task startServer(type: Exec) { workingDir file("${buildDir}/a
如何在 Ant 中定义一个目录集,其中包括两个目录:项目的基目录和子目录“test”? 看起来您无法使用“/”、“.”或“”专门包含目录集的根目录。例如,这包括“./test”,但不包括“.”:
我正在使用 CTAGs 包,它使用 Sublime Text 2 生成两个文件 .tags 和 .tags_sorted_by_file。 那么当我进行项目搜索(CMD + SHIFT + F)时,如
我是一名优秀的程序员,十分优秀!