jimguys/poemlab — pull request #45 by marclitchfield (2013-10-08 06:08:27+00:00)
Title: Template refactor

Introduce jade-browser to share templates between client and server.

jade-browser is middleware that exposes server-side jade templates as a dynamically generated js file. No build step necessary! Unfortunately there are a couple issues with it on windows: 1) the version of node-glob is older and does not work on windows, and 2) the template names will contain backslashes on windows, so the names the client refers to will vary depending on the server implementation. I forked jade-browser and fixed these issues, so currently our package.json loads jade-browser from my repo. We can shoot him a pull request if everything works on your end.

The line.jade template is now shared between the client and server. jade-browser is configured to share all .jade files in the partials folder at the /js/partials.js endpoint.

One other change that had to be made with this refactoring was standardization of the property names that are provided by the lines_repository to camelCase. We should probably standardize the property names from the other repos as well. Applied this convention to the other repositories.

Moved getPoets from poemsRepo to poetsRepo.forPoem, otherwise we would need to share the mapPoets function. This was a sign that the function probably belongs on poetsRepo anyway.