I was working on a project using embedded JS, and when I try to load a property, it displays the error “property value expected.” The code runs perfectly fine, but the error always appears at the beginning.
<label for="<%= user.id %>" style="background-color: <%= user.color %>;">
The error occurs at the beginning and end of this segment: <%= user.color %>
.
Error
[{
"resource": "",
"owner": "_generated_diagnostic_collection_name_#4",
"code": "css-propertyvalueexpected",
"severity": 8,
"message": "property value expected",
"source": "css",
"startLineNumber": 15,
"startColumn": 60,
"endLineNumber": 15,
"endColumn": 61
}]
[{
"resource": "",
"owner": "_generated_diagnostic_collection_name_#4",
"code": "css-ruleorselectorexpected",
"severity": 8,
"message": "at-rule or selector expected",
"source": "css",
"startLineNumber": 15,
"startColumn": 78,
"endLineNumber": 15,
"endColumn": 79
}]
I attempted to search online, but I was unable to find a solution for this issue. I am looking for an alternative method or solution to eliminate this error.
6
The issue can be resolved with a simple code modification, although it may not be the most well-structured solution.
Replacing the
style="background-color: <%= user.color %>;"
With
<%- 'style = "background-color: ' %><%= user.color %><%- '"' %>
This will resolve the issue for now, but it may occur again in the future.
The issue has been raised on GitHub; you can check it out as well.
GitHUB issue