Ejemplo n.º 1
0
        public AssetService(IHostingEnvironment hostingEnvironment, IOptions <WebpackOptions> options, IAssetsHttpClient assetsHttpClient = null)
        {
            if (options.Value == null)
            {
                throw new ArgumentNullException(nameof(options), "Webpack option cannot be null");
            }

            WebpackOptions webpack = options.Value;

            _developmentMode = hostingEnvironment.IsDevelopment();

            _manifestPath = _developmentMode
                ? null
                : hostingEnvironment.WebRootPath + webpack.AssetsPublicPath + webpack.ManifestFile;

            _assetPath = _developmentMode
                ? webpack.DevServer + webpack.AssetsPublicPath
                : webpack.AssetsPublicPath;

            _assetsHttpClient = assetsHttpClient;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="T:AspNetMvcWebpack.AssetHelpers.AssetsHttpClient"/> class.
 /// </summary>
 /// <param name="httpClient">Dotnet internal http client</param>
 /// <param name="options">Webpack options</param>
 /// <param name="logger">Our logger</param>
 public AssetsHttpClient(HttpClient httpClient, IOptions <WebpackOptions> options, ILogger <AssetsHttpClient> logger)
 {
     _httpClient = httpClient;
     _logger     = logger;
     _options    = options.Value;
 }