PDA

View Full Version : Ext.apply('Ext.Loader', {...}) with minified files.



xjscrafter
16 May 2014, 5:09 PM
We are implementing localization, and it works fine until I use sencha cmd to minify the app code.

Before implementing minification, we included ExtJS, localization file, and our code in this order:


<script src="ext-dev.js"></script>
<script src="localization.js"></script>
<script src="app.js"></script>


localization.js has something like this:


Ext.apply(Ext.Loader, {


locale: {
enabled: false,
language: null,
path: 'localization',
localizedByDefault: false,
extLocalePath: false,
i18nServer: false,
types: []
},


setLocale: function (config) {
Ext.apply(this.locale, config);
this.initLocaleManager();
},




It does other things, but the point is that is uses Ext.apply() to add config and functions to Ext.Loader.

The problem is that minification introduces a chicken and egg situation. Because sencha cmd creates one js file app.js that contains the ExtJS code and my app code, minified, I can't have a script tag with localization.js before the script tag for app.js, because Ext is not defined yet.

On the other hand, I can't have localization.js in a script tag after the script tag for the minified app.js, because I am using the Class register preprocessor so the localization is applied when each of my app classes is loaded by Ext.Loader.

Anyone can help with this it would be greatly appreciated.

xjscrafter
17 May 2014, 7:15 AM
Can anyone help out on this please?