Home >Backend Development >Golang >Why Does VSCode Show CSS Validation Errors in Go Templates?

Why Does VSCode Show CSS Validation Errors in Go Templates?

Patricia Arquette
Patricia ArquetteOriginal
2024-11-09 16:10:02342browse

Troubleshooting CSS Errors in VSCode While Editing Go Templates

When utilizing Go's html/template package and writing templates like mypage.tmpl, you may encounter CSS validation errors in VSCode.

For instance, the following code snippet within mypage.tmpl:

<div>

Can trigger the following errors:

  • "property value expected css (css-property value expected)"
  • "at-rule or selector expected css (css-rule selector expected)"

These errors occur when trying to utilize {{ }} within the style HTML attribute.

Solution

To resolve this issue, disable HTML validation styles in VSCode settings:

  1. Open VSCode settings.
  2. Search for "html.validate.styles".
  3. Set its value to false.

Why Does VSCode Show CSS Validation Errors in Go Templates?

Disabling HTML validation styles will prevent VSCode from attempting to validate CSS within Go templates, resolving the errors.

The above is the detailed content of Why Does VSCode Show CSS Validation Errors in Go Templates?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn