Skip to content

Instantly share code, notes, and snippets.

@rytmis
Last active August 29, 2015 14:17
Show Gist options
  • Save rytmis/c98925b84ecee561fe82 to your computer and use it in GitHub Desktop.
Save rytmis/c98925b84ecee561fe82 to your computer and use it in GitHub Desktop.
Custom parameter source for dotless engine
public class DictionaryParameterSource : IParameterSource {
public DictionaryParameterSource(IDictionary<string, string> parameters) {
this.parameters = new Dictionary<string, string>(parameters);
}
public IDictionary<string, string> GetParameters() {
return this.parameters;
}
}
var engine = new EngineFactory(DotlessConfiguration.GetDefault()).GetEngine();
var decoratedEngine = new ParameterDecorator(engine, new DictionaryParameterSource(new Dictionary<string, string> {
{ "param1", "value" }
}));
decoratedEngine.TransformToCss(less, null);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment