1
votes

I'll try to keep it short, don't want to waste your time. Working in dev environment:

template:

{% block javascripts %}
   {% javascripts '@SomeBundle/Resources/public/js/*' %}
      <script type="text/javascript" src="{{ asset_url }}"></script>
   {% endjavascripts %}

{% endblock %}

html output:

<script type="text/javascript" src="/js/98b0881_part_1_fill_form.jquery_1.js"></script>                            
<script type="text/javascript" src="/js/98b0881_part_1_jquery-1.8.3.min_2.js"></script>

so it reads the contents of Resources/public/js dir and makes the correct number of links with the right names. When I click the given url however, i get 404 apache response:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <html><head>
        <title>404 Not Found</title>
    </head><body>
    <h1>Not Found</h1>
    <p>The requested URL /js/98b0881_part_1_jquery-1.8.3.min_2.js was not found on this server.</p>
    <hr>
    <address>Apache/2.2.22 (Ubuntu) Server at ipardon.loc Port 80</address>
</body></html>

Which pretty much means no JS for me on my page. What have i tried:

app/console assets:install web --no-dev
app/console assetic:dump --no-dev

adding bundle name in config.yml to assetic.bundles[] googling ( of course )

Anyone encountered anything like this before? I have, and "solved" it by not using assetic, but I'd like to get it right this time. Any ideas?

2
did you try app/console assetic:dump ?snyx
okay so i cleared the cache, changed assetic.use_controller to true in config.yml ( was false, but true in config_dev.yml ) and tried assetic:dump again. it made an output of files in my web dir. does this mean i'll have to call it after every change in my js files? wth? what's with that super ultra cool "assetic will dynamically generate everything" stuff? i'd really find it usefull, but it won't be workable like this!Kuro
use assetic:dump --watchsnyx
well... i can work with that, thank you, but am a bit dissapointed. controller generating js links or whatever sounded cool :)Kuro
synx could you write the dump --watch comment as an answer so i can accept it? thxKuro

2 Answers

5
votes

as described here you can use

php app/console assetic:dump --watch

it will automatic dump your assets if they are changed.

this post hast also infos on that subject

1
votes

In production you really only need to dump once per deployment, which can be automated (see Capifony).

In development don't use --no-dev parameters, this makes assetic dump compiled files only, ignoring the partial /js/98b0881_part_1_jquery-1.8.3.min_2.js