0

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 1

1

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
Sign up to request clarification or add additional context in comments.

4 Comments

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?
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/…)
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 %} {# ... #}
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

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.