How to outsource a template js to a different file when using Handlebars.js

前端 未结 2 2110
再見小時候
再見小時候 2020-12-17 04:15

I have this template script



        
2条回答
  •  清酒与你
    2020-12-17 05:01

    I would use RequireJS for this. Lovely to work with modules and there is also a plugin that is called text that works beautifully with templates.

    If it sounds interesting, here's some links:

    http://requirejs.org/

    http://requirejs.org/docs/download.html#text -- The text plugin

    RequireJS is only suitable if you want to use modules though, if not Alon's answer is better.

提交回复
热议问题