My PHP application is not showing css and js on the browser. also it is not using ascetics. how can i use assets on my application? Any help would be appreciated.Since apart from the official site not much content available on the web.
1 Answer
You must dump your js and css files in Resources/public folder of your bundle.
After, see this page to know how to integrate your files in twig template : http://symfony.com/doc/2.3/cookbook/assetic/asset_management.html
and finaly lauch this commands in your console :
php app/console assets:install web/
php app console assetic:dump
4 Comments
Rohan
thanks @Fabien. Actually when i try to check the page resource, it shows the css and js files on the it.But they are not displaying on the browser.Can you suggest any solution?
Fabien
you probably have a problem with your file inclusion in your view. Do you use {% javascript %} and {% stylesheet %} tags same in my previous link ? (symfony.com/doc/2.3/cookbook/assetic/…)
Rohan
can you please explain me how to use this {# ... #} {% block stylesheets %} {% stylesheets 'bundles/acme_foo/css/*' filter='cssrewrite' %} <link rel="stylesheet" href="{{ asset_url }}" /> {% endstylesheets %} {% endblock %} {# ... #}
Fabien
What you don't understand ? - you put your css in your [bundle]/Resources/public/css - You paste this in your template {% block stylesheets %} {% stylesheets 'bundles/[bundle]/css/*' filter='cssrewrite' %} <link rel="stylesheet" href="{{ asset_url }}" /> {% endstylesheets %} {% endblock %} (your bundle name must be write in lowercase for this tag) - you launch the two commands of my answer and we could see your css file in web/bundle/[name_of_bundle]/css/your_files.css