示例#1
0
        private static String JavascriptPackHelper(HttpContextBase context, String packageName, RouteValueDictionary htmlAttributes)
        {
            var builder     = new StringBuilder();
            var environment = GetEnvironment();
            var configPath  = context.Server.MapPath(AssetPackagesConfigPath);

            if (Environment.Development.Equals(environment))
            {
                foreach (var file in AssetsHelper.GetJavascriptPackFiles(environment, packageName, configPath))
                {
                    builder.Append(JavascriptHelper(context, file, htmlAttributes));
                }
            }
            else
            {
                var javascriptServerPath = context.Server.MapPath(JavascriptPath);
                var packageFileName      = AssetsHelper.BuildJavascriptPack(environment, packageName, javascriptServerPath, configPath);
                builder.Append(JavascriptHelper(context, VirtualPathUtility.Combine(JavascriptPath, packageFileName), htmlAttributes));
            }
            return(builder.ToString());
        }