jlongster / mortar

An Open Web Apps development template generator

Home Page:https://wiki.mozilla.org/Apps/Mortar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Back-end server

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
cd mortar
npm install
./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_init.js
css.css

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

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.

About

An Open Web Apps development template generator

https://wiki.mozilla.org/Apps/Mortar


Languages

Language:JavaScript 99.9%Language:Shell 0.1%