Z-Wave-Me/home-automation — pull request #37 by peaches (2014-05-07 08:19:23+00:00)
Title: Building assets using make

NOTE: You don't have to merge this, just thought it might be useful
for you guys if you haven't already started a project to build assets.
Using this cuts the page size from 2.7MB to ~900KB.

This depends on make, but it also has a few additional changes that
allows for the build to properly work. To build the assets, you will
need to run:

make assets

This does a few things:

- Builds a new htdocs/index.html from htdocs/template/index.html
- Uses requirejs (node) to concatenate all the js files
- Builds less files into a single all.css file
- Copies images over to the build directory
- Copies font files to the build directory
- Gzips the font files

There's also the "clean" target that removes everything inside of the
build folder, but it also does a "git checkout htdocs/index.html" to
reset it in case it changes, to run it:

make clean

To get this to work, a couple things were modified:

- A new template to generate index.html is added
- A script was added to run the templating
- Dependency on npm packages (package.json), so npm install is needed
- Modified (backbone) router.js to include files via define