Update Handlebars command-line Example to use yhandlebars #229

Closed
wants to merge 1 commit into
from
View
33 src/handlebars/docs/index.mustache
@@ -1178,31 +1178,31 @@ To see this simple server in action, save it to a file, install Express and YUI
<h5>On the Command Line</h5>
<p>
-The original Handlebars project provides a Node.js-based Handlebars command-line application that can be installed via npm and used to precompile Handlebars template files. Since the precompiled templates produced by the original Handlebars are compatible with YUI Handlebars, this is a great way to precompile your Handlebars templates manually or as part of a build process.
+There is a yhandlebars command-line application, that is based on the command-line application provided by the original Handlebars project but uses YUI Handlebars. It can be installed via npm and used to precompile Handlebars template files. This is a great way to precompile your Handlebars templates manually or as part of a build process.
</p>
<p>
First, you'll need to install <a href="http://nodejs.org/">Node.js</a> and <a href="http://npmjs.org/">npm</a> if you haven't already. See their respective websites for instructions.
</p>
<p>
-Next, install the Handlebars npm module. Note that this program is maintained by the maintainers of the <a href="https://github.com/wycats/handlebars.js">original Handlebars project</a>, so there's a chance it could change or break compatibility with YUI Handlebars without notice.
+Next, install the yhandlebars npm module.
</p>
```terminal
-$ npm install -g handlebars
+$ npm install -g yhandlebars
```
<p>
-Now you can run the `handlebars` executable to precompile a template into JavaScript code.
+Now you can run the `yhandlebars` executable to precompile a template into JavaScript code.
</p>
```terminal
-$ handlebars my-template.handlebars -f precompiled-template.js
+$ yhandlebars my-template.handlebars -f handlebars-templates.js
```
<p>
-This will compile a template to a JavaScript file which you can load on your page. You could render it like this:
+This will compile a template to a YUI module file which you can load on your page. You could render it like this:
</p>
```
@@ -1215,23 +1215,10 @@ This will compile a template to a JavaScript file which you can load on your pag
<script src="http://yui.yahooapis.com/{{{yuiVersion}}}/build/yui/yui-min.js"></script>
<script>
-YUI().use('handlebars-base', 'get', 'node', function (Y) {
- // Create a global Handlebars variable that points to Y.Handlebars. This is
- // necessary for compatibility with precompiled templates generated by the
- // original Handlebars project.
- window.Handlebars = Y.Handlebars;
-
- // Load the precompiled template JS onto the page.
- Y.Get.js('precompiled-template.js', function (err) {
- if (err) {
- Y.error('Template failed to load: ' + err);
- return;
- }
-
- // Render the template and insert its output into the page.
- var output = Y.Handlebars.templates['my-template']({food: 'pie'});
- Y.one('#content').append(output);
- });
+YUI().use('handlebars-templates', 'node', function (Y) {
+ // Render the template and insert its output into the page.
+ var output = Y.Handlebars.templates['my-template']({food: 'pie'});
+ Y.one('#content').append(output);
});
</script>
</body>