Question

I have 2 files, one is a .css (inside vendor/somevendor/somelibrary/css/), and the other one is a .scss (inside @ProjectMainBundle/Resources/public/css/).

I want the .scss to be compiled into a .css with the Sass filter, and then both .css files to be minified with the Yui filter. I have tried different variations of this:

    {% stylesheets
        '%kernel.root_dir%/../vendor/somevendor/somelibrary/css/somelibrary.css'
        '@ProjectMainBundle/Resources/public/css/*'
        filter='compass,yui_css' %}
        <link rel="stylesheet" type="text/css" media="screen" href="{{ asset_url }}" />
    {% endstylesheets %}

The problem is that the Sass filter is also being applied to the .css file, which throws indentation errors.

In my config.yml I added the corresponding 'apply_to' parameter but didn't help:

    # Assetic Configuration
    assetic:
            debug:          %kernel.debug%
            use_controller: false
            bundles:        [ProjectMainBundle]
            #java: /usr/bin/java
            filters:
                    cssrewrite: ~
                    #closure:
                    #    jar: %kernel.root_dir%/Resources/java/compiler.jar
                    sass:
                            bin: /usr/local/bin/sass        
                            apply_to: "\.scss$"
                    compass:
                            bin: /usr/local/bin/compass
                            apply_to: "\.scss$"
                    yui_css:
                            jar: %kernel.root_dir%/../vendor/yahoo/yui-compressor/build/yuicompressor-2.4.7.jar
                            apply_to: "\.css$"
                    yui_js:
                            jar: %kernel.root_dir%/../vendor/yahoo/yui-compressor/build/yuicompressor-2.4.7.jar
                            apply_to: "\.js$"

So how do I do this? I don't want to have more than 1 resulting .css.

Was it helpful?

Solution

Found it: https://github.com/kriswallsmith/assetic/issues/101

Remove the 'filter=compass,yui_css' part.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top