Revert "Bug 987487 - [Gaia] [Build] Refactoring webapp-optimize.js and unit tests"
This broke a lot of apps.

This reverts commit 3cc2733bc0e5ec952a4c1edfc115b814b49edb95.