Skip to content

VS Code – unified checking of javascript, html, and CSS code as a whole – prior to running on a browser?

Forgive me if this is a really stupid question, but I haven’t found any answers yet – or maybe I don’t know the correct thing to ask for.

Given the following files that are part of the same project:

  • MyProject.html
  • MyProject.css
  • MyProject.js

(and a that runs on the server to make things happen)

. . . where all three of these items are related and are actually part of a single project and they need to integrate together.

The “html” part of VS code makes sure the html is correct.
The “css” part of VS code makes sure the css is correct.
the JavaScript part of VS code makes sure the javascript is correct.

However, they may not be correct together as a unified whole – I may have changed something in the javascript that references something in the html that may not yet exist – because I forgot to write it, and I don’t discover this until I launch things and watch the web-page go all pear-shaped in ways I’ve never heard of before.

Is there something that will take all these pieces and say “Hey! You changed the definition of this element here in the Javascript but not in the HTML (or the CSS or whatever)

In other words, not only do I want to know if the individual files are syntactically correct, but do they agree with each other?

If there is a “something” that does this, what is it called?



That tool will never exist and for good reasons, it’d slow the living hell out of your computer when programming and wouldn’t fair well as a best practice. Though it’s cool, it’s cooler to write code effectively and not have a slow code editor. So to that suggestion is write your JavaScript and HTML together hand in hand; split view and you won’t ever have an issue. CSS can come into play any time.

Your best option for knowing if code is correct, would be a linter but that won’t help you with the issues you face if you’re calling elements that don’t exist or did you’ll want to improve how you code these functions/events.

As requested submitted as an answer for the OP.

User contributions licensed under: CC BY-SA
7 People found this is helpful