Opened 12 years ago

Closed 12 years ago

#4331 closed enhancement (fixed)

Allow building a custom dojo.js base

Reported by: James Burke Owned by: James Burke
Priority: high Milestone: 1.0
Component: BuildSystem Version: 0.9
Keywords: Cc:
Blocked By: Blocking:

Description

For some testing/specialized cases, we should allow building custom dojo.js base files.

Change History (7)

comment:1 Changed 12 years ago by James Burke

Resolution: fixed
Status: newclosed

(In [10391]) Fixes #4331. Allow building a custom dojo.js base.

comment:2 Changed 12 years ago by alex

I'd like to go a bit further and suggest that we should build in pragma support for what's in Base to deal with building for special platforms. E.g., it would be nice to strip out everything that's IE focused when we're building for iphone. What do you think?

comment:3 Changed 12 years ago by James Burke

Resolution: fixed
Status: closedreopened

Here is what I'm thinking for syntax, feel free to suggest something else. I was looking at this syntax to first apply it for xdomain builds, where loader_xd.js overrides two functions in loader.js. In that case, I do not want to include those two loader.js functions in the output.

For excluding content:

//>>dojo.excludeStart("marker1", kwArgs.loader == "xdomain");

If kwArgs.loader == "xdomain" is true, then this code is removed.

//>>dojo.excludeEnd("marker1");

For including content:

//>>dojo.includeStart("marker2", kwArgs.loader == "xdomain");

If kwArgs.loader == "xdomain" is true, then this code is included.

//>>dojo.includeEnd("marker2");

The "kwArgs" variable is the variable that includes all the build command options and all the properties inside the profile.js file. That was the only object I was going to make visible for use in the conditional expressions.

I was not going to support "else" or "else if" since that got more complex, but I'm open to suggestions. If there is something already existing or a syntax that would be better, I'm open to that. This was the first pass and something relatively easy to do.

comment:4 Changed 12 years ago by James Burke

(In [10411]) Refs #4331. build function that supports conditional pragmas (just exclude and include). Still need to plug it in to the actual build process, but here is a start to get a review. Test files included.

comment:5 Changed 12 years ago by James Burke

In r10411, I removed the "dojo." prefix from the conditional comments to avoid any confusion where people would actually look for those methods defined somewhere. So the supported syntax looks like:

For excluding content:

//>>excludeStart("marker1", kwArgs.loader == "xdomain");

If kwArgs.loader == "xdomain" is true, then this code is removed.

//>>excludeEnd("marker1");

For including content:

//>>includeStart("marker2", kwArgs.loader == "xdomain");

If kwArgs.loader == "xdomain" is true, then this code is included.

//>>includeEnd("marker2");

Unless I hear objections soon, I'll likely plug this into the build process soon to strip out the two functions in loader.js that are also defined in loader_xd.js.

comment:6 Changed 12 years ago by James Burke

(In [10423]) Refs #4331. Adding conditional comments to strip out functions duplicated in dojo.xd.js.

comment:7 Changed 12 years ago by James Burke

Resolution: fixed
Status: reopenedclosed

(In [10424]) Fixes #4331. At least for now. Conditional comment processing only run against layer files right now. Implemented one conditional to remove dupe methods from loader.js that are defined in loader_xd.js. Only saved 150 bytes on gzip size of dojo.xd.js, but it helps prove the concept.

Note: See TracTickets for help on using tickets.