(on Saturday, 27 December 2008, 10:55 PM -0800):
> I'm trying to reduce the number of file requests per page load for my
> dojo enhanced ZF app. I created a profile and generated a release, but
> I still have 32 or so file requests. Some of them look like duplicates,
> as well.
>
> I'm kinda stuck between the documentation on the dojo site (started with
> the documentation for an early version, but that was a total waste of
> time). I've looked at Matthew's pastebiin demo app (both the download
> tarball, and the most recent stuff on github), and also read a bunch of
> posts here. Seems like all of this is a fast moving target. None of
> the examples match the docs or posts.
>
> Is there recent documentation on the best way to go about this?
Here's the easiest way:
* Create a layer file that contains all your dojo.require() statements:
In public/js/<your custom module>/main.js (I'll call it "custom"):
dojo.provide("custom.main");
(function(){
dojo.require("dijit.form.Form");
dojo.require("dijit.form.Button");
/* etc. */
})();
* In your bootstrap, make sure you reference this layer file:
$view->dojo()->requireModule("custom.main");
* Create a profile: public/js/util/buildscripts/profiles/custom.profile.js
/* ./build.sh profile="custom" */
dependencies = {
action: "release",
version: "1.2.2-custom", /* this can be arbitrary */
releaseName: "custom",
loader: "default",
cssOptimize: "comments.keepLines",
optimize: "shrinksafe",
layerOptimize: "shrinksafe",
copyTests: false,
layers: [
{
name: "../custom/main.js",
layerDependencies: [],
dependencies: [
"custom.main",
]
}
],
prefixes: [
[ "dijit", "../dijit" ],
[ "dojox", "../dojox" ],
[ "custom", "../custom" ]
]
}
* From within public/js/util/buildscripts, execute:
$ ./build.sh profile="custom"
* The build will be created in public/js/release/custom
* Now replace public/js with public/js/release/custom, and you'll be
set.
You'll need to clear your browser cache to notice the changes.
--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/
没有评论:
发表评论