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
Release: 2024-11-09 16:10:02
Original
350 people have browsed it

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>
Copy after login

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!

source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template