Ejemplo n.º 1
0
        public String GetUrl(CssResourceDefinition defintion)
        {
            String path = null;

            if (this.EnableCDN)
            {
                path = IsDebuggingEnabled ? defintion.CdnDebugPath : defintion.CdnPath;

                if (String.IsNullOrEmpty(path))
                {
                    path = defintion.CdnPath;
                }
            }

            if (String.IsNullOrEmpty(path))
            {
                path = IsDebuggingEnabled ? defintion.DebugPath : defintion.Path;

                if (String.IsNullOrEmpty(path))
                {
                    path = defintion.Path;
                }

                path = Page.ResolveUrl(path);
            }

            return(path);
        }
Ejemplo n.º 2
0
        public void AddDefinition(string name, CssResourceDefinition definition)
        {
            if(String.IsNullOrEmpty(definition.Path)) {
                throw new ArgumentException("CssResourceDefintion.Path doesn't contain valid URL.");
            }

            base.AddDefinition(name, definition);
        }
Ejemplo n.º 3
0
        public void AddDefinition(string name, CssResourceDefinition definition)
        {
            if (String.IsNullOrEmpty(definition.Path))
            {
                throw new ArgumentException("CssResourceDefintion.Path doesn't contain valid URL.");
            }

            base.AddDefinition(name, definition);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Renders the appropriate CSS links as defined and references.
        /// </summary>
        /// <param name="referenceNames"></param>
        public void Render(IEnumerable <String> referenceNames)
        {
            if (Page.Header == null)
            {
                throw new InvalidOperationException("The Page or MasterPage must contain a HEAD tag with the 'runat=\"server\"' attribute.");
            }

            Control container = Page.Header.Controls.All().Where(c => c is CssPlaceholder).SingleOrDefault() ?? Page.Header;

            foreach (String reference in referenceNames)
            {
                String linkId = String.Concat("juice_", reference);

                if (container.FindControl(linkId) != null)
                {
                    continue;
                }

                CssResourceDefinition defintion = CssManager.CssResourceMapping.GetDefinition(reference);
                String url = GetUrl(defintion);

                if (String.IsNullOrEmpty(url))                  // we have a ton of checks in place before we get here. if something went wrong, just continue;
                {
                    continue;
                }

                HtmlLink link = new HtmlLink {
                    ClientIDMode = ClientIDMode.Static,
                    ID           = linkId,
                    Href         = url
                };

                link.Attributes.Add("type", "text/css");
                link.Attributes.Add("rel", "stylesheet");

                container.Controls.Add(link);
            }
        }
Ejemplo n.º 5
0
        public String GetUrl(CssResourceDefinition defintion)
        {
            String path = null;

            if(this.EnableCDN) {
                path = IsDebuggingEnabled ? defintion.CdnDebugPath : defintion.CdnPath;

                if(String.IsNullOrEmpty(path)) {
                    path = defintion.CdnPath;
                }
            }

            if(String.IsNullOrEmpty(path)) {
                path = IsDebuggingEnabled ? defintion.DebugPath : defintion.Path;

                if(String.IsNullOrEmpty(path)) {
                    path = defintion.Path;
                }

                path = Page.ResolveUrl(path);
            }

            return path;
        }
Ejemplo n.º 6
0
 public void AddDefinition(string name, Assembly assembly, CssResourceDefinition definition)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 7
0
 public new void AddDefinition(string name, Assembly assembly, CssResourceDefinition definition)
 {
     throw new NotImplementedException();
 }