JQuery UI CSS import not working

I've been using Symfony for years, but I'm new to Symfony2.

When I include jQuery and jQuery UI in my Symfony2 project, I find that all JavaScript is working correctly, but not all CSS is happening, although I include the main jQuery UI CSS file that should make all the styles work.

It seems to me that the jQuery CSS is not working as the paths in the CSS import mean nothing to Symfony:

// web/js/development-bundle/themes/base/jquery.ui.base.css
@import url("jquery.ui.core.css");
@import url("jquery.ui.resizable.css");

      

Obviously, jquery.ui.core.css

without a path, Symfony won't work.

So what should I do? How is this handled normally in Symfony2?

+3


source to share


1 answer


These are just CSS import declarations and I don't think symfony will get in the way of them. Are you getting 404 errors when your page tries to access them?

It looks like it is similar to this question / answer: Where did Symfony2 split CSS and JS resources, best practices?

One of the (not accepted) answers suggests the following:

{% stylesheets '../app/Resources/public/css/*' %}
    <link href="{{ asset_url }}" type="text/css" rel="stylesheet" />
{% endstylesheets %}

      



Or, if you must use a method @import

, make sure this is the first thing in your style block:

<style type="text/css">
  @import url("jquery.ui.core.css");
  @import url("jquery.ui.resizable.css";

  ... other style declarations

</style>

      

Does this answer your question?

+1


source







All Articles