Address: http://blog.csdn.net/sushengmiyan/article/details/38313537
Sushengmiyan
--------------------------------------------------------------- Resource link -----------------------------------------------------------------------
Sencha cmd Official Website: http://www.sencha.com/products/extjs/up-and-running/cmd-getting-started
Certificate ------------------------------------------------------------------------------------------------------------------------------------------------
Use sencha cmd with ext JS 5
--------------------------
This tutorial uses the sencha generate app command of sencha cmd to create an application. This article ends by allowing an application.
Processing and updating an existing application to experience sencha CMD is introduced at the end of this chapter. First of all, it is important to understand what is "ideal" and "default, in the default structure and existing applications, driver updates are quite different.
Learning basics:
------------
If you want to read the following content, you need to understand the content of the previous section: http://blog.csdn.net/sushengmiyan/article/details/38295575
Generate your application:
The starting point is to use commands to generate an application and execute the following commands:
Sencha generate app-ext MyApp E: \ senchaworkspace \ MyApp
The following execution result is displayed:
In your hard disk folder, you can see:
This indicates that your program framework is automatically generated.
Note that extjs is a commercial version. If you have purchased it, you need to download the ext JS zip package and use the-SDK command to develop the SDK path, in this way, the SDK will not be downloaded by default, but will be generated according to your local file.
Command: sencha-SDK/here is your SDK path/generate app MyApp your app path.
After the execution is complete, you can see the following folder path:
.sencha/ # Sencha-specific files (for example, configuration) app/ # Application-specific content Boot.js # Private, low-level dynamic loader for JS and CSS Microloader.js # Loads app based on app.json content sencha.cfg # Application configuration file for Sencha Cmd build-impl.xml # Standard application build script *-impl.xml # Implementations of various build phases defaults.properties # Default values and docs for build properties ext.properties # Build property values specific to Ext JS *.defaults.properties # Build property values by env (e.g. "testing") plugin.xml # Application-level plugin for Sencha Cmd codegen.json # Data for merging generated code during upgrade workspace/ # Workspace-specific content (see below) sencha.cfg # Workspace configuration file for Sencha Cmd plugin.xml # Workspace-level plugin for Sencha Cmdext/ # A copy of the Ext JS SDK cmd/ # Framework-specific content for Sencha Cmd sencha.cfg # Framework configuration file for Sencha Cmd packages/ # Framework supplied packages ext-theme-classic/ # Ext JS Theme Package for Classic ext-theme-neptune/ # Ext JS Theme Package for Neptune ... # Other theme and locale packages src/ # The Ext JS source ...index.html # The entry point to your applicationapp.json # Application manifestapp.js # Launches the Application classapp/ # Your application's source code in MVC structure model/ # Folder for application model classes store/ # Folder for application stores view/ # Folder for application view classes main/ # Folder for the classes implementing Main.js # The Main View MainModel.js # The `Ext.app.ViewModel` for the Main View MainController.js # The `Ext.app.ViewController` for the Main View Application.js # The `Ext.app.Application` classpackages/ # Sencha Cmd packagesbuild/ # The folder where build output is placed
This path is the same as the folder above.
Construct your application
You only need to execute the following command to construct your application package.
Sencha app build. You need to execute this command in your application folder. The execution process is as follows:
You must note that you cannot use the-SDK command. problems may occur when using it.
After the execution is complete, you can see that the build directory is added. below is the folder containing JS Code sass and themes.
Sencha network service container
Use the sencha Web Start command to start your service. The service allows you to use a local application as a network service.
This command sets port 1841 as the current access port. If you want to stop the service, execute the following command: sencha web stop or Ctrl + C to end the service.
To access your service, you only need to execute the following path in the browser:
Http: // localhost: 1841
When we access the service, we can see that the default webpage is as follows:
If you do not want to use port 1841, you can set the port number: sencha-port 8080 Web Start
Expand your application
Use the sencha generate command to help you quickly create an MVC component package, such as controllers and models.
Run the following command sencha help generate. You can see the following extension information:
Important: to execute commands, you must run them in the current application path.
Add a new models
-----------------------------
Run the sencha generate model command.
In this way, a user model is created and contains three attributes.
Add a new Controllers
----------------------------------
Run the sencha generate controller Central Command.
Add a view
-------------------
Similarly, execute sencha generate view someview.
Custom Constructor
--------------------------
Now, a variety of configuration options can be used in ". sencha/APP/sencha. cfg "the folder can be ignored if there is only one page ". sencha/workspace "configuration folder
Classpath class path
---------------------
The sencha app build command determines where to find your application code depends on the app. classpath configuration, which is in the ". sencha/APP/sencha. cfg" folder. The default value is
app.classpath=${app.dir}/app,${app.dir}/app.js
Higher-level reading
For more information about how to process sencha cmd commands, refer to inside the app build process.
Update your application
Use sencha app upgrade [New Path]
For existing apps, you can refer to index.html in APP. JSON:
{ ... "indexHtmlPath": "index.php"}