Skip to content
This repository has been archived by the owner on Dec 31, 2017. It is now read-only.

Commit

Permalink
Update to function with latest version of build system.
Browse files Browse the repository at this point in the history
  • Loading branch information
csnover committed Sep 19, 2011
1 parent 0da8541 commit 6ec25f4
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 7 deletions.
37 changes: 34 additions & 3 deletions profiles/main.profile.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,55 @@
/**
* Build profiles look mostly the same in Dojo 1.7 as they do in previous versions of the toolkit.
*/
dependencies = {
// First cleans the dist directory of existing code, then builds a new release.
action: 'clean,release',
async: true,

// Strips all comments from CSS files.
cssOptimize: 'comments',

// Excludes tests, demos, and original template files from being included in the built version.
mini: true,

// Uses ShrinkSafe as the JavaScript minifier. This can also be set to "closure" to use Closure Compiler.
optimize: 'shrinksafe',

// This is the directory within the output directory that built JavaScript will be placed.
releaseName: 'js',

// Strips all calls to console functions within the code.
stripConsole: 'all',

// Builds can be split into multiple different JavaScript files called "layers". This allows applications to
// defer loading large sections of code until they are actually required. Note that, at the moment, module IDs
// in "dependencies" are still written using dots instead of slashes.
layers: [
{ name: '../app/_base.js', resourceName: 'app._base', dependencies: [ 'app._base', 'app.main' ] }
// The default selector engine is not included by default in a dojo.js build in order to make mobile builds
// smaller. We add it back here to avoid that extra HTTP request.
{ name: 'dojo.js', dependencies: [ 'dojo.selector.acme' ] },

// This is our main application layer. This layer will normally contain most or all of your application code.
{ name: '../app/main.js', dependencies: [ 'app.main' ] },

// In the demo application, we conditionally require app/Dialog on the client-side, so we're building a
// separate layer containing just that client-side code.
{ name: '../app/Dialog.js', dependencies: [ 'app.Dialog' ] }
],

// Each package requires a defined prefix so that the builder can find and combine modules into a single file.
// The first string in each array is the package name, and the second string is the path to that package, relative
// to the directory containing dojo.js.
prefixes: [
[ 'dijit', '../dijit' ],
[ 'dojox', '../dojox' ],
[ 'app', '../app' ],
[ 'dbp', '../dbp' ]
],

// Providing hints to the build system allows code to be conditionally removed on a more granular level than
// simple module dependencies can allow. This is especially useful for creating tiny mobile builds.
// Keep in mind that dead code removal only happens in minifiers that support it! Currently, ShrinkSafe does not
// support dead code removal; Closure Compiler and UglifyJS do.
staticHasFeatures: {
'dojo-sync-loader':0
}
}
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
src="js/dojo/dojo.js" defer></script>

<!-- Load the application. -->
<script src="js/app/_base.js" defer></script>
<script src="js/boot.js" defer></script>
</body>
</html>
28 changes: 28 additions & 0 deletions src/js/boot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* This file is used to reconfigure parts of the loader at runtime for this application. We've put this extra
* configuration in a separate file, instead of adding it directly to index.html, because it contains options that
* can be shared if the application is run on both the client and the server.
*
* If you aren't planning on running your app on both the client and the server, you could easily move this
* configuration into index.html (as a dojoConfig object) if it makes your life easier.
*
* This file must remain outside of any defined package directory at the current time or it will be transformed by the
* build system into a legacy module.
*/
require({
// The base path for all packages and modules. If you don't provide this, baseUrl defaults to the directory
// that contains dojo.js.
baseUrl: 'js/',

// A list of packages to register. Strictly speaking, you do not need to register any packages,
// but you can't require "app" and get app/main.js if you do not register the "app" package (the loader will look
// for a module at app.js instead). Unregistered packages also cannot use the packageMap feature, which might
// be important to you if you need to relocate dependencies.
packages: [
{ name: 'dojo', location: 'dojo' },
{ name: 'dijit', location: 'dijit' },
{ name: 'dojox', location: 'dojox' },
{ name: 'app', location: 'app' },
{ name: 'dbp', location: 'dbp' }
]
}, [ 'app' ]);
2 changes: 1 addition & 1 deletion src/server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# This is a very simple script that demonstrates how to load a Dojo
# application on the server using Node.js.

node js/dojo/dojo.js load=app/_base
node js/dojo/dojo.js load=boot
6 changes: 4 additions & 2 deletions util/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ fi

cd "$UTILDIR"

# copy the config.js file
cp "$SRCDIR/js/boot.js" "$DISTDIR/js/boot.js"

# copy the index.html and make it production-friendly
cp "$SRCDIR/index.html" "$DISTDIR/index.html"

sed -i -e "s/ <!-- This is removed automatically by the Dojo Boilerplate build script in production. -->//" \
-e "s/<script>isDebug = true;<\/script>//" "$DISTDIR/index.html"
sed -i "s/, *isDebug: *1//" "$DISTDIR/index.html"

echo "Build complete"

0 comments on commit 6ec25f4

Please sign in to comment.