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
- Borrows a lot of tricks from html5boilerplate
- Comes with jQuery, Twitter Bootstrap, and x-tag
- Blank template for creating apps with a user interface
These are just front-end templates, but you’ll most likely need to set up a server for your app. I highly recommend the server-configs project from the h5b crew which provides really helpful templates for server configurations. That should help you get set up quickly.
The Apache .htaccess config is not part of the above project, but part of the html5boilerplace project itsel.
To generate templates:
git clone https://github.com/mozilla/mortar.git
./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.