How to Fix 'property value expected css' and 'at-rule or selector expected css' Errors in Go Templates?

Linda Hamilton
Release: 2024-11-21 04:21:13
Original
753 people have browsed it

How to Fix

Troubleshooting "property value expected css" and "at-rule or selector expected css" Errors in Go Templates

Developers working with Go templates and the html/template package may encounter the following errors in Visual Studio Code (VSCode):

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

These errors often arise when attempting to inject dynamic values into style attributes using double curly braces {{ }} in .tmpl files.

The issue stems from the HTML validation feature in VSCode. While it helps ensure the validity of HTML syntax, it can also conflict with the use of Go templates. To resolve the problem:

  1. Open Settings in VSCode (Ctrl/Cmd ,).
  2. Search for "validate styles".
  3. Uncheck the "HTML: Validate styles" checkbox.

vscode disable validate style html

  1. Reload VSCode.

After disabling style validation, double curly braces {{ }} can be used in style attributes without triggering errors.

The above is the detailed content of How to Fix 'property value expected css' and 'at-rule or selector expected css' 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