2

How do you load a require.js plugin?!

I've read all the docs - http://requirejs.org/docs/plugins.html - but unless I've missed it, nowhere does it tell you how to load a plugin. I'm trying to load the "text" one. If I require something like: template: 'text!template.html' Chrome just gives /text!template.html.js 404 (Object Not Found), so presumably the text plugin isn't loading.

I've put it in the same dir as require.js, and tried adding it in my require header, but it doesn't seem to find it.

What have I missed?! I'm using the combined jquery-require.js file, if that is relevant. i.e. http://requirejs.org/docs/download.html#samplejquery

4

1 回答 1

1

我解决了这个问题。与网络服务器权限无关require.js,男生错误意味着没有提供文件。供参考,在require.config刚才放的text :"PATH_TO_FILE",你参考的时候会找到的"text!:..."

于 2013-04-03T11:21:09.700 回答