Razor view: conditionally include debug versions of JS libraries

In Razor compiler directives do not work, cause Razor Views are not compiled.
So this would not work:

@{ #if DEBUG}



But you can trick that thing into submission, thanks to this StackOverflow topic

A better, more generic solution is to use an extension method, so all views have access to it:

public static bool IsReleaseBuild()
    return false;
    return true;

You can then use it like follows in any view (razor syntax):