0

I'm working on a symfony2 project and all the js and css files are served from the compiled version under /assets/compiled/frontend_site_2.css /assets/compiled/frontend_jscript_2.js and the actual version of these files are under

src\projectname\Bundle\WebBundle\Resources\assets\js\jscript.js src\projectname\Bundle\WebBundle\Resources\assets\css\site.js

I want the view to render these urls instead of compiled versions, right now I 've to dump these files by running this cmd php app/console assetic:dump --watch I don't want to run this command after every single modication, is it possible?

frontend/javascript_block.htm.twig file
{% javascripts output='assets/compiled/frontend.js'
    '@projectNameWebBundle/Resources/public/js/jscript.js'
%}
<script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}

Thanks

3
  • Please refer this 1) symfony.com/doc/current/cookbook/assetic/asset_management.html 2) stackoverflow.com/questions/18749407/… Commented Sep 20, 2014 at 13:26
  • assets:install web --symlink don't solve your problem? Commented Sep 20, 2014 at 13:30
  • @Isouza, no nothing works, I've tried many things but its still serving the files from /assets/compiled/frontend_jscript_2.js, now every time I do modification to refresh this compiled version I run this cmd app/console assetic:dump. I'm tired of this. Commented Sep 20, 2014 at 13:43

1 Answer 1

0

In dev mode you can just put list of js files you want to include in 'javascripts' block, like this:

{% javascripts
'@YourBundle/Resources/public/path/to/your_js_file'
'@YourBundle/Resources/public/path/to/your_another_js_file'
 %}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}

So, it looks like your sample except this strange place: "output=". I haven't met anything like this before.

To work with javascript files without constantly run dump command you can use sample above. It works on several my projects. And I think it must work for you.

In production mode just run

assetic:dump

command and that's it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.