jsakalos
15 Dec 2008, 8:51 AM
I've been debugging my applications in Firefox3@Linux + Firebug and I included ext-all-debug.js on the development system until now. Although it worked quite fine, I was able to set breakpoints and trace my applications with Firebug, I've always had two problems:
When stepping into an Ext routine I'd always had to wait a couple of seconds until Firebug got responsive again. Also, each single step through code took a couple of seconds. I attribute it to the slowness of processing of ext-all-debug.js that has 53000+ lines.
Documentation is stripped off in ext-all-debug so I had to switch back and forth between docs Firefox tab and debugging tab.
The idea is to include individual Ext source files. Sure, the loading time gets a bit longer as we need to include 150+ files instead of one but this will pay back many times while stepping through code. For those using PHP the code is:
$jsTpl = '<script type="text/javascript" src="{file}"></script>';
$doc = new DOMDocument();
$doc->load("ext/src/ext.jsb");
$xpath = new DOMXPath($doc);
$includes = $xpath->query("//project/target[@name='Everything']/include");
foreach($includes as $include) {
$file = "ext/src/" . preg_replace("/\\\/", "/", $include->getAttribute("name"));
echo preg_replace("/\{file\}/", $file, $jsTpl) . "\n";
}
This fragment reads ext/src/ext.jsb file (ExtJS project file) and generates corresponding tags. This ensures that the individual files are included in the exactly same order that is used for ext-all-debug.js generation.
I'm very satisfied with the result; let me please know your experiences.
When stepping into an Ext routine I'd always had to wait a couple of seconds until Firebug got responsive again. Also, each single step through code took a couple of seconds. I attribute it to the slowness of processing of ext-all-debug.js that has 53000+ lines.
Documentation is stripped off in ext-all-debug so I had to switch back and forth between docs Firefox tab and debugging tab.
The idea is to include individual Ext source files. Sure, the loading time gets a bit longer as we need to include 150+ files instead of one but this will pay back many times while stepping through code. For those using PHP the code is:
$jsTpl = '<script type="text/javascript" src="{file}"></script>';
$doc = new DOMDocument();
$doc->load("ext/src/ext.jsb");
$xpath = new DOMXPath($doc);
$includes = $xpath->query("//project/target[@name='Everything']/include");
foreach($includes as $include) {
$file = "ext/src/" . preg_replace("/\\\/", "/", $include->getAttribute("name"));
echo preg_replace("/\{file\}/", $file, $jsTpl) . "\n";
}
This fragment reads ext/src/ext.jsb file (ExtJS project file) and generates corresponding tags. This ensures that the individual files are included in the exactly same order that is used for ext-all-debug.js generation.
I'm very satisfied with the result; let me please know your experiences.