📜  Sencha Touch-构建

📅  最后修改于: 2020-10-19 03:02:11             🧑  作者: Mango


当今对Web应用程序的需求是用较少的开发工作来开发快速的应用程序。 Sencha Touch可以轻松实现此目的,因为它基于开发或生产代码以及创建自定义版本的工具,提供了许多可供选择的版本库。

Sencha Touch构建库会动态加载类。动态加载代表需要时加载的类,并且仅包括应用程序中必需的那些类。随着要加载的文件数量减少,这使应用程序运行得更快,同时缩短了加载时间。

Sencha Touch 2.x提供以下五个构建库。

Sr.No. Builds & Usage
1

sencha-touchdebug.js

This build is used while developing the application locally. It is a nonminified version with all the comments and debug logs for easy debugging while development.

2

senchatouch.js

This file is used for production purpose. It is the minified version when we have a custom build.

3

sencha-touchall.js

This file is used for production purpose. It is the minified version when we do not have a custom build.

4

sencha-touchall-debug.js

This file is used for debugging in production. It is not minified and has all the comments and debug logs.

5

sencha-touchall-compat.js

This build is used to migrate the version 1.x to version 2.x. It gives a warning wherever version 1.x code is not compatible and needs code modification.

通过上述构建,Sencha Touch提供了创建自定义构建的工具。

具有自定义版本的优点

自定义构建不会加载所有触摸文件。它仅加载我们在应用程序中使用的那些文件,从而使应用程序更快速,更易于维护。

Sencha CMD用于创建自定义版本。要在Sencha CMD中创建自定义版本,请转到应用文件所在的目录,然后键入以下命令之一以创建版本。

Sr.No. Command & Usage
1

sencha app build native

Builds the app and prepares a file called packager.temp.json that you can use to package an application–the packager.temp.json is the same as packager.json, but contains additional paths.

2

sencha app build -run native

Builds and automatically packages the application, and launches the appropriate simulator.

3

sencha app build package

Builds the app with packaging support, but does not configure a packager JSON file. This is useful for projects that manually maintain multiple packager.json files.

一旦构建成功,它将生成all-classes.js文件,我们需要将其包含在index.html中以使其可以投入生产。

以下代码显示了要为生产就绪代码进行的更改。

构建应用程序之前的Index.html


      
      
   
   
   

生成应用程序后的Index.html