using System.Collections.Generic; using System.Web; using ClientDependency.Core; using ClientDependency.Core.FileRegistration.Providers; namespace Umbraco.Web.WebAssets.CDF { /// /// A custom renderer that only outputs a dependency path instead of script tags - for use with the js loader with yepnope /// public class DependencyPathRenderer : StandardRenderer { public override string Name { get { return "Umbraco.DependencyPathRenderer"; } } /// /// Used to delimit each dependency so we can split later /// public const string Delimiter = "||||"; /// /// Override because the StandardRenderer replaces & with & but we don't want that so we'll reverse it /// /// /// /// /// /// public override void RegisterDependencies(List allDependencies, HashSet paths, out string jsOutput, out string cssOutput, HttpContextBase http) { base.RegisterDependencies(allDependencies, paths, out jsOutput, out cssOutput, http); jsOutput = jsOutput.Replace("&", "&"); cssOutput = cssOutput.Replace("&", "&"); } protected override string RenderSingleJsFile(string js, IDictionary htmlAttributes) { return js + Delimiter; } protected override string RenderSingleCssFile(string css, IDictionary htmlAttributes) { return css + Delimiter; } } }