PDA

View Full Version : *** Plugin files orgnization and namespace ***



salarmehr
14 Sep 2011, 10:52 PM
I ask from all plugin and extension developers to use the following namespace pattern to isolate their plugins, so plugin changing and updating will be more easy and Ext.Loader will work perfectly: (please note to caseing)
Ext.ux.pluginName.PluginName (Master / bootstarp ns)
js/ux/pluginName/PluginName.js (Master file)

Ext.ux.pluginName.PluginName.form.field.Xxxx (example of other ns)
js/ux/pluginName/form/field/Xxxx.js (Other file)

Ext.ux.pluginName.PluginName.grid.feature.Yyy (example of other ns)
js/ux/pluginName/grid/feature/Yyyy.js (Other file)
File orgnization:

public
.......|-app
.......|-js
..............|-ext
..............|-ux
.....................|- {plugin-name}
............................|- css
............................|- img
............................|- *.js

tobiu
15 Sep 2011, 12:01 AM
since i guess app is the part of an ext mvc app, all included files and folders should only contain js. so why using a folder js on the same level?

mitchellsimoens
15 Sep 2011, 4:59 AM
In your path, you would need to do something like this:


Ext.Loader.setPath({
'Ext.ux' : '/js/ux'
});

Since you want a folder with the plugin-name, your actual class will need to be:


Ext.ux.MyPluginName.MyPluginName

and have your MyPluginName.js in this folder:


/js/ux/MyPluginName/MyPluginName.js

salarmehr
15 Sep 2011, 6:52 AM
@tobiu I think it is a good practice to separate 3rd party file from project-specific files.