-
Notifications
You must be signed in to change notification settings - Fork 643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a debug tag #247
Comments
Do you have any specific use cases in mind? Would something like a Marko DevTools chrome extension be better suited for accomplishing your goals? |
Would be nice to have a convention for enabling "Marko Debug Mode". For example, via an environment variable:
In debug mode, we could add extra information to templates. For example, What if we automatically added a <div data-template-path="/my-project/components/foo/index.marko">
<h1>Foo</h1>
<div>
<div data-template-path="/my-project/components/bar/index.marko">
<h2>Bar</h2>
</div>
</div>
</div> This information could be helpful to developers, but it could also be used to enable more advanced in-browser development tools. |
Comments might provide more info if say, <!-- Begin: /my-project/components/foo/index.marko -->
<div>
<h1>Foo</h1>
<div>
<!-- Begin: /my-project/components/bar/index.marko -->
<!-- Begin: /my-project/components/baz/index.marko -->
<div>
<h2>Baz</h2>
</div>
<!-- End: /my-project/components/baz/index.marko -->
<!-- End: /my-project/components/bar/index.marko -->
</div>
</div>
<!-- End: /my-project/components/foo/index.marko --> |
I've seen at least a few other major projects add HTML comments like that to their output for various reasons, including debugging. Angular even uses a similar syntax to bind code to the DOM ( What about something in-between? Throughout the parsing/compiling/rendering process the debug information could be stored in a property on the relevant AST node - or maybe in a parent node similar to an HtmlComment element, or perhaps even some combination of the two - then eventually rendered as HTML comments like in the example above. Then tools could be written to simply hook into the property/node to extract debug information during the compiling and rendering processes, and there would also be helpful HTML comments in the final output. Special debugging tags and attributes could also be added, like |
<invoke console.log(someData)/>
This is good, but it could be much better. 馃槃
Some thoughts on creating a debugger:
The text was updated successfully, but these errors were encountered: