Why do I can't to include css-file with AsseticBundle

54 Views Asked by At

I am a novice at Symfony, but try to create my first own project. I started project with symfony 3.4.15.

And now I have a problem with AsseticBundle. I installed it under instruction of documentation. Then I try to include css-file to my project.

    {% block stylesheets %}
        {% stylesheets 'bundles/app/css/*' filter='cssrewrite' %}
            <link rel="stylesheet" href="{{ asset_url }}" />
        {% endstylesheets %}
    {% endblock %}

But symfony ignores this block and I don't see it in html.

When I try this code:

    {% block stylesheets %}
        {% stylesheets '@AppBundle/Resources/public/css/*' filter='cssrewrite' %}
            <link rel="stylesheet" href="{{ asset_url }}" />
        {% endstylesheets %}
    {% endblock %}

css-file works, but realtive paths are broken in it (it is written in documentation, I know).

My config:

assetic:
   debug:          '%kernel.debug%'
   use_controller: '%kernel.debug%'
   filters:
       cssrewrite: ~
   read_from: '%kernel.root_dir%/../public_html'
   write_to: '%kernel.root_dir%/../public_html'

Please, help me to decide my problem.

0

There are 0 best solutions below