Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does DotLess' "web" attribute do exactly?

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?

like image 346
cjacques Avatar asked Jun 21 '12 11:06

cjacques


1 Answers

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)

like image 86
Kevin Main Avatar answered Jan 03 '23 00:01

Kevin Main