Reputation: 371
I'm new in symfony2, and I'm confused how to use css and image by asset.
For example, I have a boundle named userbundle, and i put my css and image in UserBundle/Resources/public/css and UserBundle/Resources/public/image. But by asset, they were located in web/acmeuser/css and web/acmeuser/image. They do not exist and of-course I can not show them.
answer:
The problem is because of the svn. If you have svn in both sides, which means in src/bundles and in web/bundles. If both of them is in svn control, then the command
assets:install web
will cause this exception: unlink(web//bundles/framework\images.svn\text-base\open_quote.gif.svn-base): Permission denied in \vendor\symfony\src\Symfony\Component\HttpKernel\Util\Filesystem.php on line 101 If you just removed your /web/bundles and set svn ignore to it. rerun the command and all goes well.
Upvotes: 2
Views: 3067
Reputation: 2392
You can try this.
{% block javascript %}
<link rel="stylesheet" type="text/css" href="{{ asset('bundles/UserBoundle/Resources/public/css/Filename.css') }}" ></link>
<script type="text/javascript" src="{{ asset('bundles/UserBoundle/Resources/public/js/Filename.js') }}">
</script>
{% endblock %}
Upvotes: -1