php - shortcut to add stylesheets to symfony2/twig

192

A a result of this question, I now use this code to add a stylesheet within a twig file:

{% block stylesheets %}

    {{ parent() }}

    {% stylesheets filter="sass"
        "test/newstyle.scss"
    %}
        <link rel="stylesheet" href="{{ asset_url }}" />
    {% endstylesheets %}
{% endblock %}

because this code is very unhandy, just to add one more style, I wonder if there is a more shorthand solution? Something like:

{% adStylesheet(test/newstyle.scss) %}

People are also looking for solutions to the problem: configuration - PHP will not run unless 644?

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.