2015-04-08 12 views
0

我是symfony2框架上的新開發者,事實上我遇到了一些困難:我試圖集成一個完整的前端開源應用程序,它是使用AngularJS(angularjs-Quizzler)開發的。 但是,當我整合項目,我不知道在哪裏放一些文件。例如:我有哪些使用其他JavaScript文件的JavaScript文件:symfony中的RequireJS

head.js(

    { require : "./vendor/requirejs/require.js",     size: "80196" }, 
    { underscore : "./vendor/underscore/underscore.js",    size: "43568" }, 

    { angular : "./vendor/angular/angular.js",     size: "551057" }, 
    { ngRoute : "./vendor/angular-route/angular-route.js",  size: "30052" }, 
    { ngSanitize : "./vendor/angular-sanitize/angular-sanitize.js", size: "19990" } 

) 

所以我在我的瀏覽器控制檯得到這個:

http://localhost/RSS/web/vendor/underscore/underscore.js Failed to load resource: the server responded with a status of 404 (Not Found) 

http://localhost/RSS/web/vendor/requirejs/require.js Failed to load resource: the server responded with a status of 404 (Not Found) 

http://localhost/RSS/web/vendor/angular/angular.js Failed to load resource: the server responded with a status of 404 (Not Found) 

http://localhost/RSS/web/vendor/angular-sanitize/angular-sanitize.js Failed to load resource: the server responded with a status of 404 (Not Found) 

http://localhost/RSS/web/vendor/angular-route/angular-route.js Failed to load resource: the server responded with a status of 404 (Not Found) 

我試過傳聞RequireJs包,但它看起來很複雜使用,可能會有一個更柔和的解決方案。謝謝

回答

0

謝謝您的回答,但我沒有工作就像是得到溶液,強調天以後,我已經找到一種方法,只需在我的「main.js」,使其理解symfony的通過例如 修改URL來解決我的問題:

{ require : "./vendor/requirejs/require.js",     size: "80196" } 

變成

{ require : "/MyProjectName/web/bundles/mybundle/js/vendor/requirejs/require.js",     size: "80196" } 
0

試着把它們放在js目錄下的web目錄下。

,並呼籲他們在樹枝一樣,每次{{資產( 'JS /的script.js')}}

例:

{ require : "{{asset('js/require.js')}}", size: "80196" },