precompiled把手模板骨​​干与Requirejs? [英] Precompiled Handlebars templates in Backbone with Requirejs?

查看:97
本文介绍了precompiled把手模板骨​​干与Requirejs?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用require.js和车把模板与Backbone.js的应用乱搞(我已经添加了AMD模块东西把手),只是读了pre-编译模板可以加快速度一个公平位。

I've been messing around with a backbone.js app using require.js and a handlebars templates (I've added the AMD module stuff to handlebars) and just read that pre-compiling the templates can speed it up a fair bit.

我不知道我怎么会去包括requirejs的precompiled模板。我有一个公平的几个模板编译(向上15),所以我不知道他们都应该在同一个输出文件或有自己的编译一次。此外,从它看来,编译模板共享渲染器脚本使用相同的车把命名空间,所以我不知道要求模板的时候,我将如何去有关在我的文件。

I was wondering how I would go about including the precompiled templates with requirejs. I have a fair few templates to compile (upwards of 15), so i'm not sure if they should all be in the same output file or have their own once compiled. Also, from what it seems, the compiled templates share the same Handlebars namespace that the renderer script uses, so I'm not sure how I would go about that when requiring the templates in my files.

任何意见将是真棒!

推荐答案

有一个看Requirejs-Handlebarsjs插件:<一href=\"https://github.com/SlexAxton/require-handlebars-plugin\">https://github.com/SlexAxton/require-handlebars-plugin

Have a look at the Requirejs-Handlebarsjs plugin: https://github.com/SlexAxton/require-handlebars-plugin

这篇关于precompiled把手模板骨​​干与Requirejs?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆