/// <summary>
        /// Gets the webpack asset dictionary for the specified <paramref name="configuration"/>.
        /// </summary>
        /// <param name="configuration">The webpack configuration.</param>
        /// <param name="httpServerUtility">The HTTP server utility.</param>
        /// <returns>
        /// The webpack asset dictionary.
        /// </returns>
        private static WebpackAssetsDictionary GetAssetDictionaryForConfig(WebpackConfig configuration, HttpServerUtilityBase httpServerUtility)
        {
            var assets = WebpackAssetsDictionary.FromFile(httpServerUtility.MapPath(configuration.AssetManifestPath));

            assets.RootFolder = configuration.AssetOutputPath;

            return(assets);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the webpack asset dictionary for the specified <paramref name="configuration"/>.
        /// </summary>
        /// <param name="configuration">The webpack configuration.</param>
        /// <param name="httpServerUtility">The HTTP server utility.</param>
        /// <returns>
        /// The webpack asset dictionary.
        /// </returns>
        private static WebpackAssetsDictionary GetAssetDictionaryForConfig(WebpackConfig configuration, IPathMappingService pathMappingService)
        {
            var assets = WebpackAssetsDictionary.FromFile(pathMappingService.MapPath(configuration.AssetManifestPath));

            assets.RootFolder = configuration.AssetOutputPath;

            return(assets);
        }
        internal static WebpackAssetsDictionary FromConfig(WebpackConfig webpackConfig)
        {
            WebpackAssetsDictionary dictionary;
            var serializer = new JsonSerializer();

            using (var reader = new JsonTextReader(new StreamReader(webpackConfig.AssetManifestPath)))
            {
                dictionary = serializer.Deserialize <WebpackAssetsDictionary>(reader);
            }
            dictionary.RootFolder = webpackConfig.AssetOutputPath;
            return(dictionary);
        }
Ejemplo n.º 4
0
        public static void Initialize(HttpServerUtilityBase httpServerUtility, WebpackConfig config)
        {
            if (_isInitialized)
            {
                throw new ApplicationException("Already initialized");
            }

            _httpServerUtility = httpServerUtility ?? throw new ArgumentNullException(nameof(httpServerUtility));
            _config            = config;
            var _webpackBuilder = new WebpackBuilder(_httpServerUtility);

            s_instance     = _webpackBuilder.Build(_config);
            _isInitialized = true;
        }