Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Assetic, twitter bootstrap and less

Assetic, twitter bootstrap and less

Problem

Config:

assetic:
    debug:          %kernel.debug%
    use_controller: false
    read_from:      %kernel.root_dir%/../public
    filters:
        less:
            node: /usr/bin/node
            node_paths: [/usr/local/lib/node_modules]

Twig template:

{% block stylesheets %}
{% stylesheets filter='less'
    '@MyBundle/Resources/public/bootstrap/less/bootstrap.less'
%}
    
{% endstylesheets %}
{% endblock %}

This works almost good.

I have one problem, there are no images, they are referenced relative url("../img/glyphicons-halflings.png") but they are not there.

And one question, this works with node.js, but what if I don't have node.js on production server, will it work if I just upload compiled css?

Problem courtesy of: umpirsky

Solution

I think you should use the cssrewrite filter too, like this:

{% block stylesheets %}
{% stylesheets filter='less,cssrewrite'
    '/bundles/mybundle/bootstrap/less/bootstrap.less'
%}
    
{% endstylesheets %}
{% endblock %}

Don't forget to publish your assets with this command:

app/console assets:install --symlink web

And to answer your final question, yes uploading the compiled css will do the trick.

Solution courtesy of: greg0ire

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

Assetic, twitter bootstrap and less

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×