Skip to content

Commit

Permalink
Some last minute accuracy fixes and info about dbp.
Browse files Browse the repository at this point in the history
Also typography fixes. Woo, typography!
  • Loading branch information
csnover committed Dec 29, 2011
1 parent 84f1625 commit 42d5703
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 28 deletions.
26 changes: 20 additions & 6 deletions README.md
@@ -1,4 +1,5 @@
# Dojo Boilerplate: A Starter Kit for Dojo Development
Dojo Boilerplate: A Starter Kit for Dojo Development
====================================================

The Dojo Boilerplate is a set of files to help you rapidly get up and running
with the Dojo Toolkit. It illustrates some basic best practices when working
Expand All @@ -13,7 +14,8 @@ original
project. Though that repository is no longer maintained, it was instrumental in
providing guidance for earlier versions of the AMD branch.

## Quick Start
Quick Start
-----------

0. Clone the repository using `git clone --recursive`.
1. Develop your project in `src/` until it is amazing.
Expand All @@ -34,7 +36,8 @@ directory and follow the Quick Start instructions above. If Java is missing,
you will need to install it. Node.js is optional, but will reward you with
much faster builds.

## A brief tour
A brief tour
------------

* The starting point of the boilerplate is the file at `src/index.html` for
the client, and `src/server.sh` for a server running Node.js. These files
Expand All @@ -54,18 +57,29 @@ much faster builds.
* The directory `src/dbp` contains tools you may find useful. These tools
are a work in progress, and are not yet updated to AMD syntax.


Useful resources
----------------

* [Dojo Reference Guide (latest release version)](http://dojotoolkit.org/reference-guide/)
* [Introduction to Custom Dojo Widgets](http://www.enterprisedojo.com/2010/09/21/introduction-to-custom-dojo-widgets/)
* [Dojo Reference Guide (Dojo trunk)](http://livedocs.dojotoolkit.org/)
* [Introduction to Custom Dojo Widgets](http://www.enterprisedojo.com/2010/09/21/introduction-to-custom-dojo-widgets/)

About the boilerplate
---------------------

This boilerplate is constantly updated to try to reflect the latest and
greatest features and design patterns for writing Web apps with Dojo, but
it relies heavily on information and contributions from other users. If
you have an idea, suggestion, or problem, please [report
it](https://github.com/csnover/dojo-boilerplate/issues) or create a pull
request! (Please note that you will need to have signed the [Dojo
CLA](http://dojofoundation.org/about/cla) before your pull requests are
accepted, for the good of us all!)

License
-------

The Dojo Boilerplate is licensed under the [same
terms](http://bugs.dojotoolkit.org/browser/dojo/trunk/LICENSE) as the Dojo
Toolkit. Consult the individual projects (see the Useful resources section
above) for additional licensing information.
above) for additional licensing information.
2 changes: 1 addition & 1 deletion src/app/Dialog.js
@@ -1,5 +1,5 @@
/**
* This file is a very simple example of a class declaration in Dojo. It defines the "app/Dialog" module as a new
* This file is a very simple example of a class declaration in Dojo. It defines the app/Dialog module as a new
* class that extends a dijit Dialog and overrides the default title and content properties.
*/
define([ 'dojo/_base/declare', 'dijit/Dialog' ], function (declare, Dialog) {
Expand Down
14 changes: 9 additions & 5 deletions src/app/app.profile.js
Expand Up @@ -13,11 +13,13 @@ function copyOnly(mid) {

var profile = {
// basePath is relative to the directory containing this profile file; in this case, it is being set to the
// src/ directory, which is the same place as the baseUrl directory in the loader configuration.
// src/ directory, which is the same place as the baseUrl directory in the loader configuration. (If you change
// this, you will also need to update run.js).
basePath: '..',

// This is the directory within the release directory where built packages will be placed. The release directory
// itself is defined by util/build.sh.
// itself is defined by build.sh. By default, dbp doesn’t use this because root is where packages live, but
// if you want to move the packages somewhere else, this is how to do it. (You will also need to update build.sh.)
// releaseName: '',

// Builds a new release.
Expand All @@ -30,7 +32,9 @@ var profile = {
mini: true,

// Uses Closure Compiler as the JavaScript minifier. This can also be set to "shrinksafe" to use ShrinkSafe.
optimize: 'shrinksafe',
// Note that you will probably get some “errors” with CC; these are generally safe to ignore, and will be
// fixed in a later version of Dojo.
optimize: 'closure',

// Strips all calls to console functions within the code.
stripConsole: 'all',
Expand All @@ -39,7 +43,7 @@ var profile = {
// smaller. We add it back here to avoid that extra HTTP request.
selectorEngine: 'acme',

// Builds can be split into multiple different JavaScript files called "layers". This allows applications to
// 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 while still allowing multiple modules to
// be compiled into a single file.
layers: {
Expand Down Expand Up @@ -76,7 +80,7 @@ var profile = {
return !copyOnly(mid) && /\.js$/.test(filename);
},

// Files that should not be copied when the "mini" compiler flag is set to true.
// Files that should not be copied when the mini compiler flag is set to true.
miniExclude: function (filename, mid) {
return mid in {
'app/profile': 1
Expand Down
24 changes: 12 additions & 12 deletions src/app/main.js
@@ -1,15 +1,15 @@
/**
* This file is your application's main JavaScript file. It is listed as a dependency in run.js and will
* This file is your applications main JavaScript file. It is listed as a dependency in run.js and will
* automatically load when run.js loads.
*
* Because this file has the special filename "main.js", and because we've registered the "app" package in run.js,
* whatever object this module returns can be loaded by other files simply by requiring "app" (instead of "app/main").
* Because this file has the special filename main.js, and because weve registered the app package in run.js,
* whatever object this module returns can be loaded by other files simply by requiring app (instead of app/main).
*
* Our first dependency is to the "dojo/has" module, which allows us to conditionally execute code based on
* Our first dependency is to the dojo/has module, which allows us to conditionally execute code based on
* configuration settings or environmental information. Unlike a normal conditional, these branches can be compiled
* away by the build system; see staticHasFeatures in profiles/main.profile.js for more information.
* away by the build system; see staticHasFeatures in app.profile.js for more information.
*
* Our second dependency is to the special module "require"; this allows us to make additional require calls using
* Our second dependency is to the special module require; this allows us to make additional require calls using
* relative module IDs within the body of our define function.
*
* In all cases, whatever function is passed to define() is only invoked once, and the return value is cached.
Expand All @@ -22,22 +22,22 @@ define([ 'dojo/has', 'require' ], function (has, require) {

if (has('host-browser')) {
/*
* This require call's first dependency, "./Dialog", uses a relative module identifier; you should use this
* This require calls first dependency, ./Dialog, uses a relative module identifier; you should use this
* type of notation for dependencies *within* a package in order to ensure the package is fully portable. It
* works like a path, where "./" refers to the current directory and "../" refers to the parent directory. If
* works like a path, where “./” refers to the current directory and ../ refers to the parent directory. If
* you are referring to a module in a *different* package, you should *not* use a relative module identifier.
*
* The second dependency is a plugin dependency; in this case, it is a dependency on the special functionality
* of the "dojo/domReady" plugin, which waits until the DOM is ready before finishing loading.
* The "!" after the module name indicates you want to use special plugin functionality; if you were to
* require just "dojo/domReady", it would load that module just like any other module, without any of the
* of the dojo/domReady plugin, which waits until the DOM is ready before finishing loading.
* The “!” after the module name indicates you want to use special plugin functionality; if you were to
* require just dojo/domReady, it would load that module just like any other module, without any of the
* special plugin functionality.
*/
require([ './Dialog', 'dojo/domReady!' ], function (Dialog) {
app.dialog = new Dialog().placeAt(document.body);

// It is important to remember to always call startup on widgets after you have added them to the DOM.
// It won't hurt if you do it twice, but things will often not work right if you forget to do it.
// It wont hurt if you do it twice, but things will often not work right if you forget to do it.
app.dialog.startup();

// And now…
Expand Down
2 changes: 1 addition & 1 deletion src/app/package.json
Expand Up @@ -8,7 +8,7 @@
"dojox": "current",
"util": "current"
},
"description": "Dojo Boilerplate Example Application. A quick-start application that demonstrates basic usage of the Dojo Toolkit.",
"description": "Dojo Boilerplate Example Application. A quick-start application that demonstrates basic usage of the Dojo Toolkit. This package.json file is a CommonJS Packages/1.0 manifest, with a special “dojoBuild” property to point to the build file for this package. (This is more useful for library packages than the main application package.)",
"licenses": [
{
"type": "AFLv2.1",
Expand Down
7 changes: 4 additions & 3 deletions src/app/run.js
@@ -1,14 +1,15 @@
/**
* This file is used to reconfigure parts of the loader at runtime for this application. We've put this extra
* This file is used to reconfigure parts of the loader at runtime for this application. Weve 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
* If you arent 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.
*/
require({
// The base path for all packages and modules. If you don't provide this, baseUrl defaults to the directory
// that contains dojo.js.
// that contains dojo.js. Since all packages are in the root, we just leave it blank. (If you change this, you
// will also need to update app.profile.js).
baseUrl: '',

// A list of packages to register. Strictly speaking, you do not need to register any packages,
Expand Down

0 comments on commit 42d5703

Please sign in to comment.