1

I'm trying to import css file inside twig file using assetic.

{% stylesheets 'bundles/sfeuser/css/bootstrap.css' filter='cssrewrite' %}
    <link rel="stylesheet" href="{{ asset_url }}"  type="text/css" />
{% endstylesheets %}

when I load the page. it was only HTML without style and when I checked the css file. I found out that it contains HTML content of the page loaded.

5
  • Can you explain a bit clearer what is happening? Are you saying that HTML content is appearing in the css file? Commented May 21, 2015 at 14:06
  • exactly !! there's no CSS code in the loaded bootstrap.css file .. only the HTML code of the loaded page .. Here's the steps I followed: I copied the css folder in Resources/public of SFEUserBundle then I launched the command assets:install target [--symlink] to move them to the web/bundles folder when I loaded the page .. I got this problem Is this has any thing to do with phpstorm ? Commented May 21, 2015 at 14:37
  • 2
    I solved the problem .. it's in security.yml I forgot to remove a firewall that was applied on the whole application .. that's why when the browser try to access bootstrap.css .. it's redirected to the login page that's why I get the HTML content of the login page in the CSS file Commented May 21, 2015 at 15:08
  • 1
    Glad you solved it! You can post that answer to your own question now, for anyone else with a similar problem that comes across this page. Commented May 21, 2015 at 15:11
  • Ok I'll do it ! Thank you @SuperBiasedMan ! Commented May 21, 2015 at 17:53

1 Answer 1

1

In the security.yml file I forgot to remove a firewall with authentification that was applied on the whole application.

That's why when the browser tries to access the CSS file it gets redirected to the login page. Therefore the HTML content of the login page was found in the CSS file.

Sign up to request clarification or add additional context in comments.

Comments

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.