[英]How to use app/Resources/public in Symfony2
I have got a myRandomJavascriptLibrary.js
file. 我有一个
myRandomJavascriptLibrary.js
文件。 I want to put this file in location app/Resources/public/js/
我想将此文件放在位置
app/Resources/public/js/
But I do not know how can I access to this file in app/Resources/views/base.html.twig
但是我不知道如何在
app/Resources/views/base.html.twig
访问此文件
I ran command app/console assets:install web --symlink
我运行了命令
app/console assets:install web --symlink
What is next? 下一步是什么?
There is no need to add you global assets in app/Resources
. 无需在
app/Resources
添加全局资产。 They should go directly into the web
folder. 他们应该直接进入
web
文件夹。 Command assets:install
is only for bundles resources. 命令
assets:install
仅用于捆绑软件资源。
I think you can do, using assetic : 我认为您可以做到,使用资产:
{% javascripts '../app/Resources/public/js/myRandom.js' %}
<script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.