2013-03-24 26 views
2

我用bower install threejs安装了three.js。如何开始yeoman和three.js?

然后在此之后我希望有three.js所在我的网页,所以我的app.js文件开头:

define(["jquery", "three"], function() { 
    "use strict"; 

然而,当我的页面加载浏览器控制台显示:

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9000/scripts/three.js 
Uncaught Error: Script error 

那么,它不应该像jQuery那样查找组件吗?

基本上我怎么才能开始yeoman和安装three.js?

回答

2

解决方法如下。

app.js文件需要引用上面的“three”,这指的是具有以下内容的文件main.js。

require.config({ 
    paths: { 
     jquery: '../components/jquery/jquery', 
     three: '../components/threejs/build/three' 
    }, 
    shim: { 
     bootstrap: { 
      deps: ['jquery'], 
      exports: 'jquery' 
     } 
    } 
}); 

这里的关键是threejs three.js文件所在的三点。