An Open Web Apps development template generator
JavaScript Shell
Pull request Compare This branch is 19 commits ahead, 35 commits behind mozilla:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
builds
default-project
ref
templates/app-stub
.gitignore
README.textile

README.textile

This is a tool to generate Open Web App templates. There are many kinds of apps and it’s difficult to provide one single template, so instead we offer several templates depending on the kind of app. However, we still want a “base” template that all our templates inherit from, thus this project was born to automate creating templates that share common project structure and functionality.

Project Structure:

bin – Contains the build and testing scripts
project – the base project
templates – the more specific templates
ref – reference template builds used for testing changes

Available Templates:

All templates come with volo, require.js, marketplace js lib, and a few other things.

app-stub: A blank canvas for creating apps (comes with jquery) download

To use:

git clone https://github.com/mozilla/mortar.git
cd mortar
npm install ejs
./bin/build app-stub my-app-stub

How does it work?

The project directory contains the base template. A few files have https://github.com/visionmedia/ejs tags in them, which lets more specific templates inject content.

The more specific templates in templates have a bunch of files which correspond to the EJS tags. The content in each file is injected to the corresponding tag. For example, the contents in “head.html” is injecting into the head tag in www/index.html.

Files where can specific content:

head.html
footer.html
js_global.js
js_requires.js
js_init.js

These will override tags defined in project/www/index.html and project/www/js/app.js.

Additionally, the more specific templates can have a “project” directory which will be rsync-ed over the project so that you can add/replace files.

The more specific templates can also specific a “project.json” file for advanced usage. The only supported attribute is “inherits” which specifies another template name. Mortar will sync in that template before syncing the current one, letting you only add bits and pieces to current templates.