question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Have template compiler add source metadata to HTML tags

See original GitHub issue

What problem does this feature solve?

I’m developing an all-in-one editor for webdevs that runs inside Chrome DevTools.

Just by replacing npm start with [name-not-finalized] start, users can have a fully featured text editor right inside Chrome DevTools shell, automatically pointing at their project directory.

It comes with DOM inspector, where you pick an element and it’ll literally take you to file:line:col where that element was defined. So you don’t have to look through files to figure out where that button below the header is coming from. Useful when a new dev joins a project or you’re revisiting your work after a very long time.

Watch 30 sec demo w/ a React project


And of course, it also works with Vue projects, just as awesome.

Watch 20 sec demo w/ a Vue project

Above demos were shot using locally tinkered compilers (just not clean enough to be a PR)

The goal is to deliver the ultimate developer experience ever. Other features are in development as we speak, like CSS QuickEditing, built-in image editor and a SVG editor so devs don’t have to fire up Illustrator or Photoshop to make minor tweaks to their stuff.

The only hurdle in me releasing the app is getting external players to participate in revolutionizing how we write web.

So to wrap up I have only two requests:

  • Please have the template compilers add metadata to each tag (either as data attribute, or property on DOM node itself), that contains path to *.vue file (can be relative to project root), line:col/offset where the tag opens and last line:col/offset where the tag closes.

  • Please star this issue: https://bugs.chromium.org/p/chromium/issues/detail?id=811036

What does the proposed API look like?

Something like this:

console.log(someElement.__vue__._debugSource)
// > { file: 'src/components/Header.vue', line: 12, col: 4, lineEnd: 16, col: 8 }
// or
// > { file: 'src/components/Header.vue', start: 241, end: 352 }

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
gzzhanghaocommented, Apr 26, 2018

#7127 will add source info (start & end index) to ASTElement. We can add domProps.__vue_source__ with a template compiler module after the pr get merged.

0reactions
zikaaricommented, Apr 26, 2018

@gzzhanghao looks great, thanks. But can we not have just this feature in a separate PR instead of making a big PR even bigger?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular compiler options
Instructs the Angular template compiler to create legacy ids for messages that are tagged in templates by the i18n attribute. See Mark text...
Read more >
The Content Template element - HTML - MDN Web Docs
First we start with the HTML portion of the example. First, we have a table into which we will later insert content using...
Read more >
How To View the Source Code of an HTML Document
HTML is also used to add images and assign links to text and images. These instructions are communicated through HTML tags, which are...
Read more >
Defining metadata (meta.yaml) - Conda
Specifies where the source code of the package is coming from. ... For this, conda-build 3.0 has added support for arbitrarily specifying many...
Read more >
Templates - Django documentation
The most common approach relies on templates. A template contains the static parts of the desired HTML output as well as some special...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found