JS/CSS include section replacement, Debug vs Release
Posted
by Bayard Randel
on Stack Overflow
See other posts from Stack Overflow
or by Bayard Randel
Published on 2009-05-21T23:25:04Z
Indexed on
2010/05/05
4:48 UTC
Read the original article
Hit count: 261
I'd be interested to hear how people handle conditional markup, specifically in their masterpages between release and debug builds.
The particular scenario this is applicable to is handling concatenated js and css files. I'm currently using the .Net port of YUI compress to produce a single site.css and site.js from a large collection of separate files.
One thought that occurred to me was to place the js and css include section in a user control or collection of panels and conditionally display the <link>
and <script>
markup based on the Debug or Release state of the assembly. Something along the lines of:
#if DEBUG
pnlDebugIncludes.visible = true
#else
pnlReleaseIncludes.visible = true
#endif
The panel is really not very nice semantically - wrapping <script>
tags in a <div>
is a bit gross; there must be a better approach. I would also think that a block level element like a <div>
within <head>
would be invalid html.
Another idea was this could possibly be handled using web.config section replacements, but I'm not sure how I would go about doing that.
© Stack Overflow or respective owner