Esempio n. 1
0
        public static string GetBundlePath(this IWebHostEnvironment webHostEnvironment, string name)
        {
            var productionJsFilePath = webHostEnvironment.GetProductionJsFilePath();

            if (webHostEnvironment.IsClientSideProductionBuild())
            {
                var file = Directory.GetFiles(productionJsFilePath).FirstOrDefault(f => Path.GetFileName(f).StartsWith($"{name}."));

                if (!string.IsNullOrEmpty(file))
                {
                    return($"/app/js/{Path.GetFileName(file)}");
                }
            }
            else
            {
                return($"/app/{name}.js");
            }

            return(string.Empty);
        }
Esempio n. 2
0
 public static bool IsClientSideProductionBuild(this IWebHostEnvironment webHostEnvironment)
 {
     return(Directory.Exists(webHostEnvironment.GetProductionJsFilePath()));
 }