/// <summary> /// Constructs a instance of LESS compiler /// </summary> /// <param name="createJsEngineInstance">Delegate that creates an instance of JS engine</param> /// <param name="virtualFileManager">Virtual file manager</param> /// <param name="options">Compilation options</param> public LessCompiler(Func <IJsEngine> createJsEngineInstance, VirtualFileManager virtualFileManager, CompilationOptions options) { _jsEngine = createJsEngineInstance(); _virtualFileManager = virtualFileManager; _options = options ?? new CompilationOptions(); _optionsString = ConvertCompilationOptionsToJson(_options).ToString(); }
/// <summary> /// Destroys object /// </summary> public void Dispose() { if (_disposedFlag.Set()) { if (_jsEngine != null) { _jsEngine.RemoveVariable(LESS_ENVIRONMENT_VARIABLE_NAME); _jsEngine.RemoveVariable(VIRTUAL_FILE_MANAGER_VARIABLE_NAME); _jsEngine.Dispose(); _jsEngine = null; } _virtualFileManager = null; } }