I would like to exclude some code when using release vs debug. Basically I have an internal admin section for testing that I don't to ever make it into the app store by accident :)
Ideally, I would just be able to do something like this:
#IF DEBUG
<div id="appBar" data-win-control="WinJS.UI.AppBar">
<button data-win-control="WinJS.UI.AppBarCommand" data-win-options="{id:'cmdAdmin', label:'Admin', section:'global' }">
</button>
</div>
#ENDIF
See here. There is a nuget package here to enable it without adding the code to your project directly. After you have it then you just do:
<script src="/js/debugSymbols.js"></script>
if (Debug.isDebugBuild) {
Here is the full code that you don't need if you use the nuget package:
(function () {
"use strict";
if (Debug.hasOwnProperty("isDebugBuild")) {
return;
}
var thisPackage = Windows.ApplicationModel.Package.current,
installedPath = thisPackage.installedLocation.path;
if (typeof installedPath === "string") {
if (installedPath.match(/\\debug\\appx$/i)) {
Object.defineProperty(Debug, "isDebugBuild", {
get: function () {
return true;
}
});
}
}
})();