What does DotLess' "web" attribute do exactly?
Asked Answered
W

1

15

The dotless documentation is quite limited. I can't find much information at all about the configsection options - especially what the "web" attribute does.

Can anyone enlighten me?

Wrong answered 21/6, 2012 at 11:13 Comment(0)
S
19

The code is normally pretty good documentation for open source projects ;)

Grab a copy of the code and look in dotless.Core > configuration > DotlessConfiguration.cs you will see some handy comments about all the config elements - this is the Web one

/// <summary>
///  Whether this is used in a web context or not
/// </summary>
public bool Web { get; set; }

Admittedly it doesn't tell you a great deal but find the references to that property and you come across only one place in the code where it is used -

if (!configuration.Web)
    RegisterLocalServices(pandora);  

Which starts to give you a better clue as to what it does which is this

    protected virtual void RegisterLocalServices(FluentRegistration pandora)
    {
        pandora.Service<ICache>().Implementor<InMemoryCache>();
        pandora.Service<IParameterSource>().Implementor<ConsoleArgumentParameterSource>();
        pandora.Service<ILogger>().Implementor<ConsoleLogger>().Parameters("level").Set("error-level");
        pandora.Service<IPathResolver>().Implementor<RelativePathResolver>();
    }

So it sets up in memory caching, logging to the console etc (i.e services it uses if not in a web context)

Springspringboard answered 21/6, 2012 at 12:54 Comment(2)
Thanks for your answer Kevin. You're right - I should have had a look at the source. I still think their documentation could be better ;)Wrong
When you install dotless using Nuget, it adds this line to your web.config file: <dotless minifyCss="false" cache="true" web="false" strictMath="false" />. Why would web="false" by default? Seems counterintuitive.Dibble

© 2022 - 2024 — McMap. All rights reserved.