Daum
Daum

Reputation: 955

Symfony2/Assectic: 500 error when combinding LESS/CSS

When I add a second file to my other file it seems to cause a 500 error on the first one.

    {% stylesheets
        '@MopaBootstrapBundle/Resources/public/less/mopabootstrapbundle.less'
        '@MyTestBundleBundle/Resources/public/css/main.css'

    %}
    <link href="{{ asset_url }}" type="text/css" rel="stylesheet" media="screen" />
    {% endstylesheets %}

Here is my assetic(it uses controller in dev):

assetic:
    debug:          %kernel.debug%
    use_controller: false
    #java: /usr/bin/java
    filters:
        cssrewrite: ~
        less:
            node: /usr/bin/node
            node_paths: [/usr/lib64/node_modules]
            apply_to: "\.less$"

If i remove the main.css it works fine. If I move main.css to a different stylesheets block it also works fine.

Upvotes: 1

Views: 786

Answers (2)

Daum
Daum

Reputation: 955

The issue was that my less in node was the issue. Switching this to the latest in github (1.3.1) fixed it.

Upvotes: 0

Max Małecki
Max Małecki

Reputation: 1702

I think that you forget about filter attribute.

{% stylesheets '@MopaBootstrapBundle/Resources/public/less/mopabootstrapbundle.less' '@MyTestBundleBundle/Resources/public/css/main.css' filter='less,?yui_css'%}
<link href="{{ asset_url }}" type="text/css" rel="stylesheet" media="screen" />
{% endstylesheets %}

Update.

I saw the apply_to: "\.less$" just now.

Split this block to 2 stylesheets

{% stylesheets '@...less' %}
    <link href="{{ asset_url}}" ... />
{% endstylesheets %}
{% stylesheets '@...css' %}
    <link href="{{ asset_url}}" ... />
{% endstylesheets %}

Upvotes: 1

Related Questions