DoneJS StealJS jQuery ++ FuncUnit DocumentJS
3.0.0
2.3.27

 

  • Github
  • Twitter
  • Chat
  • Forum
  • Guides
  • Core
  • Ecosystem
    • can-construct-super
    • can-define-stream
    • can-fixture
    • can-fixture-socket
    • can-jquery
    • can-stache-converters
    • can-stream
    • can-vdom
    • can-view-import
    • can-zone
    • steal-stache
  • Infrastructure
  • Legacy
  • Bitovi
    • Bitovi.com
    • Blog
    • Consulting
    • Training
    • Open Source
  • Chat
  • Forum
  • Star
  • Follow @canjs
  • CanJS
  • /
  • Ecosystem
  • /
  • steal-stache
  • / On this page
    • steal-stache

      module

      A StealJS extension that allows stache templates as dependencies.

      • source

      STACHE_MODULE_NAME!steal-stache

      Import a stache module in your code and use it to render.

      var template = require("./main.stache");
      var Map = require("can-map");
      
      var map = new Map();
      var frag = template(map);
      
      // frag is a live-bound DocumentFragment
      

      Parameters

      1. STACHE_MODULE_NAME {moduleName}:

        The module name of a stache template. This will typically be something like templates/main.stache.

      Returns

      {renderer(data, helpers, nodeList)}:

      A renderer function that will render the template into a document fragment.

      Use

      With StealJS used from node_modules, steal-stache will configure Steal so stache modules can be loaded like:

      import todosStache from "todos.stache"
      todosStache([{name: "dishes"}]) //-> <documentFragment>
      

      Specifying Dependencies

      This plugin allows <can-import> elements that specify template dependencies:

      <can-import from="components/my_tabs"/>
      <can-import from="helpers/prettyDate"/>
      
      <my-tabs>
        <my-panel title="{{prettyDate start}}">...</my-panel>
        <my-panel title="{{prettyDate end}}">...</my-panel>
      </my-tabs>
      

      CanJS is part of DoneJS. Created and maintained by the core DoneJS team and Bitovi. Currently 3.0.0.