Templates in JS?

前端 未结 4 978
花落未央
花落未央 2021-01-17 03:55

All we like simple, structured code that is easy to comply with. We try to bring a difference between appearance and logics. In PHP, for instance, we can use a template mech

相关标签:
4条回答
  • 2021-01-17 04:20

    I've used things like js-template for client side templates. For server side, whatever template mechanism was present in the system at hand could usually be applied to plain text javascript files.

    0 讨论(0)
  • 2021-01-17 04:37

    Try looking into jQuery Templates. It is one of the many solutions available.

    0 讨论(0)
  • 2021-01-17 04:38

    There are many js template engin as below. Choose as you want. Handlebars is my suggestion.

    1. Handlebars. http://handlebarsjs.com/
    2. jquery template. http://api.jquery.com/jQuery.template/
    3. Ejs http://embeddedjs.com/.
    4. Underscore has template engin. http://documentcloud.github.com/underscore/#template
    5. trimpath http://code.google.com/p/trimpath/wiki/JavaScriptTemplates
    6. John Resig's micro template engin. http://ejohn.org/blog/javascript-micro-templating/
    7. mustaches is also a good one. https://github.com/janl/mustache.js/
    0 讨论(0)
  • 2021-01-17 04:41

    Underscore.js has simple templating mechanism as well. (And I think it must be in every javascript developer's toolbox).

    jQuery's is more sophisticated, though - and probably more useful (Update: but now is deprecated).

    0 讨论(0)
提交回复
热议问题