Search code examples
asp.net-mvccombres

Combres and DotLessCssFilter


Well in short term I can't get it to work. The filter doesn't seem to apply it self.

I'm trying to get combres to work with my MVC 3 razor application. And I've got everything to work except the DotLessCssFilter.

In the documentation it says In order to apply a filter to your resource sets, you need to modify your Combres config file

I've modified the combres.config like this:

<combres xmlns='urn:combres'>
    <filters>
        <filter type="Combres.Filters.DotLessCssFilter, Combres" acceptedResourceSets="dotLessCss" />
    </filters>
    <resourceSets url="~/combres.axd" defaultDuration="30" defaultVersion="1" defaultVersionGenerator="Combres.VersionGenerators.Sha512VersionGenerator">
        <resourceSet name="siteCss" type="css">
            <resource path="~/UI/Styles/1140.css" />
            <resource path="~/UI/Styles/typeimg.css" />
            <resource path="~/UI/Styles/layout.css" />
        </resourceSet>
        <resourceSet name="siteJs" type="js">
            <resource path="~/UI/Scripts/opt/util.js" />
            <resource path="~/UI/Scripts/opt/core.js" />
        </resourceSet>
    </resourceSets>
</combres>

And it combines the files and minifies as it should.

In one of my files I have a simple less-syntax:

@sprite: url(/ui/styles/sprite.png);

.foo {
  background-image: @sprite;
}

But it seems that it's never put through the filter.

Don't know if this is a MVC problem or a general one.

Anyone used this filter successfully?

Never mind! (EDIT)

See answer


Solution

  • Missed the acceptedResourceSets="dotLessCss" it need to have the proper resourceSet name so in my case:

    acceptedResourceSets="siteCss"