Sunday, 15 September 2013

twig - how to reload a javascript asset in Symfony2? -



twig - how to reload a javascript asset in Symfony2? -

i have code below (it's in twig file) attach javascript file specific template.

<script type="text/javascript" src="{{ asset("bundles/myappmybundle/js/jobs.js") }}"></script>

it working fine except fact if made changes javascript file, somehow browser (firefox firebug) still loading previous version.

i've tried:

clearing cache via php app/console rm -rf app/cache/*

any ideas on how prepare this?

thanks lot

it might in 2 cases:

your browser cached js you. seek clear cache of browser

you installed assets 1 time hard-copy alternative (by default). , after changed files didn't update assets php app/console assets:install.

to create assets synced bundle's code can run in cli:

php app/console assets:install --symlink

it create symlink src/yourbundle/resources/public folder in /web/bundles/

symfony2 twig

No comments:

Post a Comment