csslesssquishit

SquishIt.Less ProcessIncludes() not working for CSS file


I have a Less file which includes a CSS file, then a set of Less files. With SquishIt I want to combine and minify these, but it ignores the CSS file unless I rename it to .css.less. I believe ProcessIncludes() is intended for this purpose but makes no difference.

Does anyone know why ProcessIncludes() doesn't do anything on a CSS file linked in a Less file?

(This is a follow up to: this question about Squishit.Less not working at all, it now works for the Less files.)


Solution

  • There is a configuration option for dotLess called "InlineCssFiles" that I believe does what you need. You can use your own configuration by overriding the static property "EngineBuilder" (its a Func) on less preprocessor. So in App_Start you could do something like this:

    LessPreprocessor.EngineBuilder = () => new EngineFactory
                {
                    Configuration = new DotlessConfiguration
                        {
                            InlineCssFiles = true,
                        }
                }.GetEngine();