2012-02-12 75 views
0

我正在编写一个示例UserScript,作为要点托管,RequireJS作为模块加载器。RequireJS作为github上托管的UserScripts的模块加载器

这就是:https://gist.github.com/1809547/4dd8eed18810525f1ae41f685f739870748c94f2

的要旨如下:

  • hola.user.js处于安装userscript - 它会跟你打招呼
  • index.js是主控制器文件
  • 其他文件'hola'模块(greetingsspeech

一切都很正常:如果你install the hola userscript,应该问候你在控制台有一个很好:

喜!

-

但我陷入麻烦when trying to introduce CoffeeScript support,例如在index.coffee

然后我得到了一个跨域问题:

的XMLHttpRequest无法加载https://raw.github.com/gist/1809547/index.coffee。 Access-Control-Allow-Origin不允许来源http://example.org

任何想法解决这个问题?

谢谢

回答

1

它看起来像你对cs插件的引用有错误的网址。

线#your code 35引用

cs: 'https://raw.github.com/jrburke/require-cs/master/cs' 

但正确的链接有一个.js extension--应该是:

cs: 'https://raw.github.com/jrburke/require-cs/master/cs.js' 
+0

不,这是好:https://开头原料。使用此语法将github.com/jrburke/require-cs/master/cs.js资源正确加载到文档中。 – abernier 2012-02-13 10:09:58