Skip to content

VScode debug EJS files of HEXO theme? #5161

Discussion options

You must be logged in to vote

As I currently understand the HEXO architecture, it's simply not possible to use breakpoints within an EJS template file.

As a best practice, one should restrict the template files to only the visual elements needed to construct the webpage. All logic more complex than a simple variable call (<%= myVar %>) or simple function call (<%- myFunc() %>) should be moved to a Hexo helper ƒunction in your theme's script/helpers/ folder.

Complex code that doesn't build the visual HTML elements should be a helper. Such helpers can be debugged in VScode with breakpoints as it is processed through an eval() function by HEXO. Once the JS file is loaded, VScode will bound the breakpoint and enable you t…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by lorezyra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant