简体   繁体   English

Symfony2在组件中找不到jquery.js文件

[英]Symfony2 can't find jquery.js file in components

I am trying to follow this tutorial to install bootstraps in symfony2: https://coderwall.com/p/kzyiaw 我正在尝试按照本教程在symfony2中安装引导程序: https ://coderwall.com/p/kzyiaw

When I run this command from terminal: php app/console assetic:dump --force 当我从终端运行此命令时:php app / console assetic:dump --force

I get this error: 我收到此错误:

17:46:25 [file+] /var/www/html/learn-symfony/app/../web/js/06837fc_part_1.js

  [RuntimeException]                                                                                      
  The source file "/var/www/html/learn-symfony/app/Resources/public/js/vendor/jquery.js" does not exist.

In composer.json, I have the jquery installed in the components directory: 在composer.json中,我在组件目录中安装了jquery:

"require": {
    ...............
    "components/jquery": "*"
}

I can find the directory and the jquery file from route/components but composer is looking in the wrong folder. 我可以从route / components中找到目录和jquery文件,但是composer在错误的文件夹中查找。 In config.yml, I have this under assetic configuration: 在config.yml中,我在资产配置下有这个:

 assets:
    jquery_js:
        inputs:
           - '%kernel.root_dir%/Resources/public/js/vendor/jquery.js'

In the Resources directory under the app, the only folders that exist are java and views. 在应用程序下的Resources目录中,仅存在的文件夹是java和views。

What should I be changing in order for composer find the jquery.js file? 为了使作曲家找到jquery.js文件,我应该更改什么?

Composer doesn't need to find the file, Assetic needs to find it. Composer不需要找到文件,Assetic需要找到它。

I currently use jquery loaded with components/jquery and have the assetic set up like so.. 我目前使用的jQuery加载了components / jquery并进行了资产设置。

assetic:
    ... debug, filters, etc ...
    assets:
        jquery: %kernel.root_dir%/../vendor/components/jquery/jquery.min.js
        underscore: %kernel.root_dir%/../vendor/components/underscore/underscore-min.js
        and so on...

This is loading the file with the source as the components/jquery folder in the vendor directory. 这将使用源作为供应商目录中的components / jquery文件夹加载文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM