Javascript symfony中的RequireJS
我是symfony2框架的新开发人员,事实上我遇到了一些困难:我正在尝试集成一个使用AngularJS AngularJS Quizzler开发的全前端开源应用程序。 但是当我整合项目时,我不知道把一些文件放在哪里。例如:我得到了一个使用其他JavaScript文件的JavaScript文件:Javascript symfony中的RequireJS,javascript,angularjs,symfony,requirejs,Javascript,Angularjs,Symfony,Requirejs,我是symfony2框架的新开发人员,事实上我遇到了一些困难:我正在尝试集成一个使用AngularJS AngularJS Quizzler开发的全前端开源应用程序。 但是当我整合项目时,我不知道把一些文件放在哪里。例如:我得到了一个使用其他JavaScript文件的JavaScript文件: head.js( { require : "./vendor/requirejs/require.js", size: "80196" },
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包,但它似乎使用起来很复杂,可能有一个更软的解决方案。谢谢试着把它们放在js目录的web目录中 每次{{asset'js/script.js'}都这样用细枝调用它们 例如:
{ require : "{{asset('js/require.js')}}", size: "80196" },
谢谢你的回答,但我不是那样工作来解决问题的,在紧张的一天之后,我找到了解决问题的方法,只需修改main.js中的URL,使symfony可以理解 例如: 变成
{ require : "/MyProjectName/web/bundles/mybundle/js/vendor/requirejs/require.js", size: "80196" }
{ require : "/MyProjectName/web/bundles/mybundle/js/vendor/requirejs/require.js", size: "80196" }