Setting up your application

Sencha Cmd supports an advanced concept described as workspaces. In complex projects, there may be the need for multiple pages or sections, in essence, applications within the larger app. Workspaces allow you to share common code (such as session management, custom UI components, and helper classes across these various subapplications). It also avoids the need to duplicate framework code (that is, the Ext JS source) across the subapps.

Note

The Sencha Cmd documentation has detailed documentation on workspaces at http://docs.sencha.com/cmd/5.x/workspaces.html.

Generating a workspace can be done with the following command:

sencha generate workspace ./my-workspace

This simply adds some configuration files for the workspace. The extra magic comes when you generate an application for this workspace:

sencha -sdk ~/<path-to-sdk>/ext generate app MyApp ./my-workspace/my-app

The key difference here is that the SDK will be held at the workspace root rather than the application root. So, the subapplications will all use the same SDK.

Alternatively, you can use Sencha Cmd to generate just an application, which we've already touched on:

sencha -sdk ~/<path-to-sdk>/ext generate app MyApp ./my-app

This will build on the standard application template we've used many times before.

While workspaces are a useful method to organize your code and promote code reuse, we're going to focus on single applications for the rest of the book. All the ideas we're discussing can be implemented on an application level without the distraction of a workspace.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset