/// <summary> /// Gets a instance of minifier /// </summary> /// <param name="minifierName">Minifier name</param> /// <returns>Instance of minifier</returns> public IMinifier GetMinifierInstance(string minifierName) { IMinifier minifier; lock (_minifiersPoolSynchronizer) { if (_minifiersPool.ContainsKey(minifierName)) { minifier = _minifiersPool[minifierName]; } else { if (minifierName == Constants.MinifierName.NullMinifier) { minifier = new NullMinifier(); } else { MinifierRegistration minifierRegistration = _assetConfig.Minifiers[minifierName]; if (minifierRegistration == null) { throw new MinifierNotFoundException( string.Format(Strings.Configuration_MinifierNotRegistered, OutputCodeType, minifierName)); } string minifierFullTypeName = minifierRegistration.Type; minifier = Utils.CreateInstanceByFullTypeName <IMinifier>(minifierFullTypeName); } _minifiersPool.Add(minifierName, minifier); } } return(minifier); }
/// <summary> /// Gets a instance of minifier /// </summary> /// <param name="minifierName">Minifier name</param> /// <returns>Instance of minifier</returns> public IMinifier GetMinifierInstance(string minifierName) { IMinifier minifier; lock (_minifiersPoolSynchronizer) { if (_minifiersPool.ContainsKey(minifierName)) { minifier = _minifiersPool[minifierName]; } else { if (minifierName == Constants.MinifierName.NullMinifier) { minifier = new NullMinifier(); } else { MinifierRegistration minifierRegistration = _assetConfig.Minifiers[minifierName]; if (minifierRegistration == null) { throw new MinifierNotFoundException( string.Format(Strings.Configuration_MinifierNotRegistered, OutputCodeType, minifierName)); } string minifierFullTypeName = minifierRegistration.Type; minifier = Utils.CreateInstanceByFullTypeName<IMinifier>(minifierFullTypeName); } _minifiersPool.Add(minifierName, minifier); } } return minifier; }