Skip to content

Commit

Permalink
Initial Commit. Corrected copyright year. Modified README.
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve Holsinger committed Jul 19, 2016
1 parent 8914087 commit f988ada
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 1 deletion.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016 Stephen Holsinger
Copyright (c) 2012 Stephen Holsinger

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,33 @@
# demandware-template-debugger
An instructional repository for techniques used in debugging Demandware templates.

# Usage #
First, make sure that the TemplateDebugger.ds file is included in the template. This can be done within its own `<isscript/>` block, or an existing one. Keep in mind that the include needs to be present before the `TemplateDebugger.debug()` method can be utilized. Therefore, it is recommended that a dedicated `<isscript/>` block be used, and placed at the top of the ISML file. It is important to delete these elements once done debugging, to avoid null reference errors or performance issues in production environments.

<iscomment><!-- DELETE AFTER USE: V !!!! --></iscomment>
<isscript>var TemplateDebugger = require('int_dev_suite/cartridge/scripts/util/TemplateDebugger.ds');</isscript>
<iscomment><!-- DELETE AFTER USE: ^ !!!! --></iscomment>


Once the TemplateDebugger.ds file is included, place a `TemplateDebugger.debug()` call in any existing `<isscript/>` bock, or create a dedicated `<isscript/>` block. Any variable, either in an `<isscript/>` block, or an `<isset/>` declaration, that was present before the `TemplateDebugger.debug()` call will be visible.

Multiple `TemplateDebugger.debug()` calls may be required. You need one call for each individual breakpoint needed.

<iscomment><!-- DELETE AFTER USE: V !!!! --></iscomment>
<isscript>TemplateDebugger.debug();</isscript>
<iscomment><!-- DELETE AFTER USE: ^ !!!! --></iscomment>

Once the required tags are in place, add a script debug breakpoint to the line with the `return` statement of the `exports.debug()` method. Run the script debugger, and navigate to the correct pipeline which will render the ISML file being debugged.

# Viewing the variables in your template #
Within the "Debug View" window, it will list the active breakpoint. From there, click the, "-toplevel-" thread. Doing so will open the Template's thread, at which point, the template variables are visible in the "Variables View" window.

![Screenshot of Debug View after clicking '-toplevel-'](toplevel-debug-view.png "Top Level Debug View")

# Authors & Contributors

* Steve Holsinger (@sholsinger) - Original author ([see original](https://www.evernote.com/shard/s61/sh/524210c5-3830-4681-8fe2-0af02f881e7d/b986e34e00b62ddb))
* Ethan Gaudette (@egaudette)

# Contributing
Simply submit a pull request. We also welcome issues to be entered by the community if you are unable to address the issue yourself.
46 changes: 46 additions & 0 deletions TemplateDebugger.ds
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/**
* Demandware Template Debugger
* https://github.com/sholsinger/demandware-template-debugger
*/

/*
To use, make sure that the TemplateDebugger.ds file is included in the
template. This can be done within its own <isscript/> block, or an existing
one. Keep in mind that the include needs to be present before the
TemplateDebugger.debug() method can be utilized. Therefore, it is recommended
that a dedicated <isscript/> block be used, and placed at the top of the
.isml file. It is important to delete these elements once done debugging, to
avoid null reference errors.

<iscomment><!-- DELETE AFTER USE: V !!!! --></iscomment>
<isscript>var TemplateDebugger = require('int_dev_suite/cartridge/scripts/util/TemplateDebugger.ds');</isscript>
<iscomment><!-- DELETE AFTER USE: ^ !!!! --></iscomment>

Once the TemplateDebugger.ds file is included, place a TemplateDebugger.debuger() call in any existing <isscript/> bock, or create a dedicated <isscript/> block.
Any variable, either in an <isscript/> block, or an <isset/> declaration, that was present before the TemplateDebugger.debug() call will be visible.
Multiple TemplateDebugger.debug() calls are required for each individual breakpoint needed.

<iscomment><!-- DELETE AFTER USE: V !!!! --></iscomment>
<isscript>TemplateDebugger.debug();</isscript>
<iscomment><!-- DELETE AFTER USE: ^ !!!! --></iscomment>

Once the required tags are in place, add a script debug breakpoint to the
return method, of the exports.debug() method. Run the script debugger, and
navigate to the correct pipeline which will render the .isml file being
debugged.

At this point, the debugger should find the hook on the
exports.debug() method. Within the "Debug View" window, it will list the
active breakpoint. From there, click the, "-toplevel-" thread.

This will open the Template's thread, at which point, the template variables
are visible in the "Variables View" window.
*/

/**
* A blank function that will give you a breakpoint (when called) within a template.
**/
'use strict';
exports.debug = function () {
return true;
}
Binary file added toplevel-debug-view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f988ada

Please sign in to comment.