ASP.NET server control which provides automatic combination, minification, and CSS constants for your style sheets.

"This is the best and easiest implementation I've seen so far for handling style sheets."-Joshua Jones

Combine

StyleManager automatically combines your style sheets, reducing the number of CSS files which need to be downloaded.

Minify

StyleManager automatically simplifies and compresses your style sheets, reducing bandwidth usage and download times.

CSS Constants

Allows you to define and re-use values in your style sheets making development and on-going maintenance more manageable.

Powerful & Simple

StyleManager optimizes more than HTTP handlers and is simpler than build scripts. It's intuitive to use and well documented.

Oh yeah? What else?

Easy Integration

Just add StyleManager around your existing styles.

    <gb:StyleManager runat="server">
        <Styles>
            
            <link type="text/css" rel="stylesheet" href="~/2.css"/>
            <link href="~/includes/css/1.css"/>
        

            
            <style type="text/css">
                .mySelectorA { border: solid 1px green; } 
                .mySelectorB { color: Aqua; } 
            </style> 
        </Styles>
    </gb:StyleManager>

Relative Background Image Urls

Support for tilde (~) in background image urls.

    .logo { 
        background-image: url( ~/includes/images/logo.png ); 
    }

Cache Management

Created files include an identifying key to prevent caching of previous styles.

    MyCssGroup-v=9268966359762623624.css

Render to the Head Element

The CSS is always added to the Head tag, regardless of where the StyleManagers are located.

    <head>
        <title>My Page</title>
        <link href="MyMasterPageCss-v=833859.css" rel="stylesheet" type="text/css" />
        <link href="MyPageCss-v=926896.css" rel="stylesheet" type="text/css" />
        <link href="MyControlCss-v=663597.css" rel="stylesheet" type="text/css" />
    <head/>
    

Easily Add CSS Files Programmatically

No more fetching of the master page's Head tag, use of placeholders, or manual creation of Link tags.

    this.MyStyleManager.AddCssFile("~/addedDynamically.css");

Embedded CSS

Optionally render the processed CSS directly to the head tag, negating the need to download any style sheets at all.

in aspx:

    <gb:StyleManager runat="server" RenderCssOnPage="true" > 
        <CssFiles>
            <gb:FileReference Path="~/foo.css" />
            <gb:FileReference Path="~/bar.css" />
        </CssFiles>
    </gb:StyleManager>

generated:

    <head>
        <title>My Page</title>
        <style type="text/css">.fooStyle{color:blue}.barStyle{color:red}</style>
    <head/>

Seeing is believing

In this real-world usage the overall download time of the styles was reduced by 91% - making the page load over four seconds faster.

Who's using it?