Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

requireJS use require to load text

I'm using backbone with requireJS and I have several template files, I would like to use require() to load the templates without passing it in the module definition, for instance inside a login function in the view, I'd want to do somethign like

var html = require( ['text!templates/users/login_form.html'] );
like image 213
Carlos Cessa Avatar asked Nov 25 '25 02:11

Carlos Cessa


1 Answers

Did you download the RequireJS text plugin? You need to download it and it put it your project before RequireJS can use text resources as dependencies. You can read about it here on the project page and also in their API documentation.

like image 135
bosgood Avatar answered Nov 26 '25 14:11

bosgood