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.
bin – Contains the build and testing scripts
project – the base project
templates – the more specific templates
ref – reference template builds used for testing changes
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
git clone https://github.com/mozilla/mortar.git
npm install ejs
./bin/build app-stub my-app-stub
How does it work?
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:
These will override tags defined in
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.