PDA

View Full Version : Understanding Sencha Cmd



marco-broglia-sifa
30 Jan 2014, 2:10 AM
Hi all,

i'm using ext-all.js for my application but is quite slow to load.

Is there a way to use sencha cmd for scanning my application and generate a custom ext-app.js using only the class that my app requires?

I known i can use the bootstrap.js but i prefer to load all the classes at the beginning to have no delays when a person clicks on the button. Additionally use the bootstrap wastes time because u need to specify all the usefull classes on the requires property, and is not enough to declare an xtype.

Thanks for help

scottmartin
30 Jan 2014, 5:36 AM
When Cmd builds, it uses what is in bootstrap to build all-classes.js .. only what is needed, not the same as ext-all

marco-broglia-sifa
30 Jan 2014, 5:48 AM
In generated all-classes.js are included only my custom class. But if in my page i don't include ext-all.js nothing works.


The only difference between all-classes.js and app-all.js is the second is minified.


What i would like instead is an ext-app.js that include all usefull classes from framework (ie. Ext.form.Panel, Ext.window.Window) but not the unnecessary (ie. Ext.chart.* cause nowhere in my application i use charts).

Thanks for reply anyway :)

scottmartin
30 Jan 2014, 6:23 AM
Which version of Cmd are you using?

The file all-classes.js is just that .. All Ext.* and MyApp.* .. where Ext.* is what is needed. If this is not the case, then there is something that is excluding the classes.

You should be able to see the un-compiled version using 'sencha app build testing'

You can always build your own using sencha compile:
http://docs.sencha.com/extjs/4.2.2/#!/guide/command_compiler

marco-broglia-sifa
30 Jan 2014, 7:06 AM
from the documentation:all-classes.js - This file contains all of your application's classes. It is not minified so is very useful for debugging problems with your built application. In our example this file is empty because our "Hello Ext" application does not contain any classes.But the example code is:


Ext.application({
name: 'HelloExt',
launch: function() {
Ext.create('Ext.container.Viewport', {
layout: 'fit',
items: [
{
title: 'Hello Ext',
html : 'Hello! Welcome to Ext JS.'
}
]
});
}});

So at least 'Ext.container.Viewport' should be included in that files....

marco-broglia-sifa
3 Feb 2014, 2:28 AM
Anyone can help me?

scottmartin
3 Feb 2014, 4:48 AM
If you build using
'sencha app build testing', you should see everything uncompiled.

marco-broglia-sifa
11 Feb 2014, 5:31 AM
I've tried to generate a new app with sencha cmd using

sencha -sdk ext generate app MyApp app

but nothing happened.Anyone can help me?

scottmartin
11 Feb 2014, 6:03 AM
-sdk ext

That should be the path to ext.

so:



sencha -sdk /path/to/sdk generate app MyApp /path/to/MyApp




sencha -sdk ~/Sites/extjs4 generate app MyApp ~/Sites/MyApp

marco-broglia-sifa
11 Feb 2014, 6:05 AM
ehm...that's the path to ext.

this is my folder structure

|--main
----ext
----app

and i've run the command into the main folder

scottmartin
11 Feb 2014, 6:13 AM
Now I am confused .. it seems like you have already generated your app?

Are you trying to build your app into a compiled version?
Did you see my info about building the app above to see all the code?

marco-broglia-sifa
11 Feb 2014, 6:40 AM
the app folder is empty.Anyway removing it don't move the problem

scottmartin
11 Feb 2014, 7:28 AM
OK.. so you are trying to generate a new app, and when you generated your app is empty?

Sounds like you set to 'ext' to specify where you wanted ext to be .. instead you need to set the path to where you have ExtJS4 installed so it can use our SDK to build your skeleton app.

If there is nothing there, just delete main and start over and use the generate I last provided.

Also .. make sure you are using Ext4.1.1a+ .. as previous versions will not work.

marco-broglia-sifa
11 Feb 2014, 7:29 AM
In the ext folder there is the full extjs 4 framework

scottmartin
11 Feb 2014, 7:37 AM
I am not sure if your setup, but typically you would have your SDK installed in a DIR under your web root:

Lets call it /var/www/extjs4

Then you would generate a new app to an new DIR under your web root like

sencha -sdk /var/www/extjs4 generate app MyApp /var/www/myapp

Under myapp, there would be app, ext, resources .. etc ..

scottmartin
11 Feb 2014, 7:38 AM
The ext under your my app is not the same contents as the SDK you downloaded from our site.

marco-broglia-sifa
11 Feb 2014, 7:38 AM
sencha -sdk /var/www/extjs4 generate app MyApp /var/www/myapp


is exacly the same command i've perform

scottmartin
11 Feb 2014, 7:43 AM
And do you have this DIR? That is where you have download our SDK to?
/var/www/extjs4

You are on a linux box? .. and this is your web root /var/www

marco-broglia-sifa
11 Feb 2014, 7:45 AM
Obviously i've use the same command with different path...

i'm on a window machine and both with relative or absolute path nothing happen.

scottmartin
11 Feb 2014, 7:46 AM
OK,, just wanted to make sure ;)

So when you generated your app, what is in your 'myapp' DIR? Is it valid?

marco-broglia-sifa
11 Feb 2014, 7:48 AM
myapp dir isn't created...another time: nothing happen (not something wrong happens but nothing happen)

scottmartin
11 Feb 2014, 7:48 AM
Also .. can you confirm the version of Ext4 and Cmd that you are using?

When you say nothing happened .. do you mean no dir/files where created at all , or that they are not valid?

scottmartin
11 Feb 2014, 7:53 AM
Can you post the exact command that you entered.
Do you have the correct permissions to your web root
if you add --debug to your generate command, what is your output. You will get a more verbose output.

scottmartin
11 Feb 2014, 7:54 AM
Also ,, what is the response you get for this:
java -version

marco-broglia-sifa
11 Feb 2014, 8:01 AM
1.7.0_25

scottmartin
11 Feb 2014, 8:04 AM
If you could post the answer to some of my questions above, about the versions, DIR rights, our exact command, and output, etc

So we can look past that.

marco-broglia-sifa
11 Feb 2014, 8:17 AM
Version of? Ext? 4.2.2


DIR rights are full


The exact command is always the same:

sencha -sdk ext generate app MyApp app

Or with the absolute path:

sencha -sdk C:\xampp\htdocs\extTst\ext generate app MyApp C:\xampp\htdocs\extTst\app

The command does not output nothing.

scottmartin
11 Feb 2014, 8:39 AM
If you type in 'sencha', what is your output.

Why would you generate an app in the same DIR where you have the SDK installed?

Perhaps it is failing due to this.

what if you enter:


sencha -sdk C:\xampp\htdocs\extTst\ext generate app MyApp C:\xampp\htdocs\myapp


Assuming that C:\xampp\htdocs\extTst\ext is where you downloaded our SDK to?
Typically it would be something like: C:\xampp\htdocs\ext

So then, it would be:


sencha -sdk C:\xampp\htdocs\ext generate app MyApp C:\xampp\htdocs\myapp

scottmartin
11 Feb 2014, 8:44 AM
I need to ask the obvious .. do you have sencha cmd installed? since you say 'nothing' happens:
http://cdn.sencha.com/cmd/4.0.1.45/release-notes.html

Windows link at top of notes for installer

If you enter 'sencha', it should show the version


? sencha
Sencha Cmd v4.0.1.45
Sencha Cmd provides several categories of commands and some global switches. In
most cases, the first step is to generate an application based on a Sencha SDK

marco-broglia-sifa
11 Feb 2014, 8:50 AM
In that machine i develop more than one project. Every project need to have his own sdk. But this is not the problem.

The app and the sdk are in different folder.

extTst\ext the sdk
extTst\app the app

But these are not problems, the problem is that the command will not produce output.

Sencha cmd is correctly installed, in fact if i try to generate a jsb of an existing app it work (read first post of this topic).

Anyway if i type sencha this is the output

[WARN] The current working directory is not a recognized Sencha SDK or application folder. Running in backwards compatible mode

Sencha Command v2.0.0 Beta 3

and after the command list.

The warn is not a problem cause i specify the sdk path when i call the generate app command.

scottmartin
11 Feb 2014, 8:57 AM
Sencha Command v2.0.0 Beta 3

There is your problem .. you have the old SDK version that is no longer in use or supported.

Use this link to install Sencha Cmd, different from our Sencha Command / SDK
http://cdn.sencha.com/cmd/4.0.1.45/release-notes.html

marco-broglia-sifa
11 Feb 2014, 11:59 PM
I realized the problem while writing. I try with newest version. Thanks a lot for all