Covers the project with browser tests, not only V8 via node/iojs. Tests are runned with [zuul](https://github.com/defunctzombie/zuul) which
provides simple local browser testing, aswell as cloud testing on multiple browsers with [saucelabs](http://saucelabs.com).
CLI used to render a mustache template with a data view, writes the template into stdout when successfull. Otherwise meaningfull errors into stderr.
Fixes#424
- Documented required version of npm while developing
- Use the latest npm client for node >= v0.8 on travis
Special quirks to get node v0.6 supported:
- npm client v1.3.26 on travis
- jshint 2.4.4 as >= 2.5.x breaks
This commit is a complete rewrite of the core mustache.js file with two
main goals: 1) a major performance boost and 2) better compliance with
the mustache spec.
In order to improve performance templates are pre-compiled to JavaScript
functions. These compiled functions take a view, a partials object, and
an optional callback as arguments. They are cached to prevent
unnecessary re-compilation of an already compiled template. Both of
these enhancements facilitate a generous boost in performance.
A few other notes:
- The mustache.js file is now both browser and CommonJS ready without
any modification.
- The API exposes two main methods: Mustache.compile and
Mustache.render. The former is used to generate a function for a given
template, while the latter is a higher-level function that is used to
compile and render a template in one shot. Mustache.to_html is still
available for backwards compatibility.
- The concept of pragmas is removed to conform more closely to the
original mustache spec. The dot symbol still works to reference the
current item in an array.
- The parser is much more strict about whitespace than it was before. The
rule is simple: if a line contains only a non-variable tag (i.e. not
{{tag}} or {{{tag}}}) and whitespace, that line is ignored in the
output. Users may use the "space" option when compiling templates to
preserve every whitespace character in the original template.
- The parser is able to provide detailed information about where errors
occur when parsing and rendering templates, including the line number
and surrounding code context.
It was confusing to present the concept of dereferencing a nested object and
enumerating over a list in an same example intended to show dereferencing a
nested object. I believe this example illustrates the concept more clearly.
I was getting the following error when running `rake commonjs`:
```
rake aborted!
no such file to load -- rspec/core/rake_task
(See full trace by running task with --trace)
```
This was with a default OS X Lion install. The issue was simply that
rspec was not installed, however, it may not be obvious at first.