/dojo-boilerplate

A starting point for developing with Dojo

Primary LanguageJavaScript

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 with Dojo. The master branch uses the standard Dojo build system; if you're feeling adventurous, there is also a branch that uses AMD modules and is built using RequireJS.

Huge thanks go out to neonstalwart for his original dojo-requirejs-template project. Though that repository is no longer maintained, it was instrumental in providing guidance for integrating RequireJS with Dojo 1.6.

Quick Start

  1. Clone the repository.
  2. Run util/setup.sh to automatically download all required dependencies.
  3. Develop your project in www/ until it is amazing.
  4. Run util/build.sh, which will create an awesome optimised build in dist/.
  5. Upload dist/ for millions of people the world over to enjoy.
  6. Hapyness.

If you already have a clone of the repo, and just want to create a new instance of it, run make new=/dir/to/create, and it will copy the files to the directory you specify.

Windows Users

If you have Git for Windows installed, boot up Git Bash and verify some dependencies by running the following commands:

which java
which curl

If both java and curl are available then cd to your project directory and follow the Quick Start instructions above. Currently, Git Bash doesn't ship with make, so running the MakeFile won't work from Git Bash.

A brief tour

  • The starting point of the boilerplate is the file at www/index.html. This file is responsible for loading base Dojo, telling Dojo where to look for modules in the app and dbp namespaces, and finally loading your application's base JavaScript file.
  • The file www/js/app/base.js is your application's base JavaScript file. In it, you can specify dependencies on other files, including files you create. You can also write application code, though the code you write in this particular file should be limited to bootstrapping functionality.
  • The file util/build.sh takes your application files and builds them for production use using the Dojo build tool. It depends on the presence of the bootstrapping file at www/js/app/base.js, and a "profile" file at profiles/app.js.
  • The file www/css/app.css contains import statements to load the CSS for Dojo's Claro theme. If you are not using Dijit widgets, you probably want to remove these imports!
  • The directory www/js/dbp contains tools you may find useful. These tools are a work in progress.

Useful resources

License

The Dojo Boilerplate is licensed under the same terms as the Dojo Toolkit. Consult the individual projects (see the Useful resources section above) for additional licensing information.