2015-02-23 66 views
2

config.ymlSymfony和作曲家部件夾

jquery: 
     inputs: 
       - %kernel.root_dir%/../vendor/components/jquery/jquery.min.js 

composer.json

"require": { 
    "components/jqueryui" : "dev-master", 
    "components/jquery": "dev-master" 
}, 
//... 

Jquery的位於供應商\作曲家但symfony的不reconzie此路徑:

[消息]源文件 「F:\ UniServerZ \ www \ app /../ vendor/jquery/jquery/jquery.min.js」不存在 。

我怎樣才能鏈接到部件/文件夾?....

+0

我建議你將jQuery放在框架的供應商之外。你爲什麼需要它?這是一個.js文件,它不是命名空間,而應該通過'cdn'導入。 – Nevertheless 2015-02-23 19:31:31

+0

我想要一個總是實際的JQuery。 – user3468055 2015-02-23 19:43:15

+0

你確定你的config.yml和張貼在這裏一樣嗎? – 2015-02-23 19:45:41

回答

5

好吧,我想那是因爲jQuery的應該是公開的文件夾,在web,所以你不是可以從外部訪問它。

composer.json:

"config": { 
    "bin-dir": "bin", 
    "component-dir": "web/components" 
}, 

比你可以使用它像(assetic):

{% javascripts 'components/jquery/jquery.min.js' %} 
    <script src="{{ asset_url }}"></script> 
{% endjavascripts %} 

希望它能幫助。

+0

我還必須做'composer需要robloach/component-installer'來將這個安裝程序添加到'.json'中。這個安裝程序是能夠解釋'component-dir'配置的安裝程序。如果沒有這個,作曲家將'components'安裝在根目錄而不是'web'目錄下。更多信息請訪問https://github.com/RobLoach/component-installer – 2015-08-21 23:55:25