• Register
  • Log In
  • Home
  • Quick Start
    • Configurator
    • Download YUI 3
  • Documentation
    • User Guides
    • Examples
    • API Docs
    • Environments
    • Tutorials
  • Community
    • Gallery
    • Blog
    • Forums
    • YUI Theater
    • Calendar
  • Contribute
    • YUI on GitHub »
    • File a Ticket
    • View Tickets
    • Dashboard
  • Other Projects
    • Shifter »
    • Yogi »
    • YUI 2
    • YUI Doc »
    • YUI Test
    • YUI Website
    • YUI Compressor »
    • YUI Builder »
    • YUI PHP Loader
    • Grid Builder »
    • Skin Builder »
  • YUI
  • >
  • Community
  • >
  • Gallery

Gallery

Modules

  • Home
  • Featured
  • Popular
  • New
  • All

Documentation

  • Yogi Documentation
  • Shifter Documentation
  • Developer Guide
  • Module Setup

Tag Cloud

Context Navigation

    YUI Library is not responsible for bugs or support with this module. It is available as a free service. For support please contact the module owner with the provided links.

    Mustache (gallery-mustache)

    Last Updated: 05/10/12
    + 0 -

    Derek Gathright

    YUI Developer

    See 2 more by this user.

    Created: 05/23/11
    Project: YUI 3
    License: MIT license
    YUI Version: 3.6.0pr1
    Free for use.

    Mustache is a cross-language template library the simplifies the process of creating strings with dynamic values.

    Update: As of YUI 3.5.0, Handlebars is a core module available within YUI. Unless there is a specific reason you'd like to use Mustache, it is recommended you use Handlebars instead.

    Note: Mustache's performance is slightly slower than Y.substitute. So, if you are in an environment where performance matters and you don't specifically need Mustache, consider using Y.substitute. See perf test @ http://jsperf.com/yui-mustache-vs-y-substitute

    More info
    http://mustache.github.com/
    https://github.com/janl/mustache.js

    • Tags:
    • templates
    • mustache
    • Download
    • Docs
    • Homepage
    • Bugs
    • Source
    • Example
    • Forum
    • History

    Code Sample

    <script src="//yui.yahooapis.com/3.3.0/build/yui/yui.js"></script>
    <script>
     
        YUI({
            modules: {
                'gallery-mustache': {
                    fullpath: 'https://github.com/derek/yui3-gallery/raw/master/build/gallery-mustache/gallery-mustache.js'
                }
            }
        }).use('gallery-mustache', function(Y) {
     
            var template = "{{title}} spends {{calc}}";
     
            var view = {
                title: "Joe",
                calc: function() {
                    return 2 + 4;
                }
            }
     
            var output = Y.mustache(template, view);
     
            console.log(output);
     
        });
     
    </script>

    Forum Posts

    Subject Author Date
    jsfiddle example: Andrew Wooldridge 05/25/11

    © 2006-2013 Yahoo! Inc. All rights reserved.
    All code on this site is licensed under the BSD License unless stated otherwise.
    About This Site · Security Contact Info