Skip to content

Debugging

TheCloudlessSky edited this page Mar 2, 2012 · 1 revision

It is important that each asset can be easily debugged, especially during development. By default, the package container looks at the HttpContext.Current.IsDebuggingEnabled property to check if debugging is enabled. Alternatively you can EnableDebugging() or DisableDebugging() on the PackageContainer.

HTML Tags

When debugging, all assets are rendered to an individual HTML tag. This significantly increases the ability to debug each asset. Additionally version parameters are not added to each asset HTML tag. For example:

<script type="text/javascript" src="/assets/core.js?debug=js/vendor/underscore-1.3.1.js"></script>
<script type="text/javascript" src="/assets/core.js?debug=js/vendor/backbone-0.9.1.js"></script>
<script type="text/javascript" src="/assets/core.js?debug=js/app/1.js"></script>
<script type="text/javascript" src="/assets/core.js?debug=js/app/2.js"></script>
<script type="text/javascript" src="/assets/core.js?debug=js/app/3.js"></script>
<script type="text/javascript" src="/assets/core.js?debug=templates/f1e24613-dc84-4653-bb02-244702e86c17.js"></script>
<link rel="stylesheet" type="text/css" href="/assets/core.css?debug=style/lib.less" />
<link rel="stylesheet" type="text/css" href="/assets/core.css?debug=style/test.less" />

However, when not debugging, assets are rendered into individual package tags:

<script type="text/javascript" src="/assets/core.js?v=3fa224672904"></script>
<link rel="stylesheet" type="text/css" href="/assets/core.css?v=9b6e23712485" />

Caching

When debugging, assets are not cached client/server-side - they are read from disk for each request. More details can be found in the HTTP Caching section.

Processing

Regardless of the debug state, the Preprocess() is always called against an asset. However, when not debugging, the Process() method is executed after the Preprocess() method. For more details on processing, check out the Processors section.