How to disable CSS errors for HTML files using Visual Studio Code (on Mac)
Asked Answered
D

2

5

I am using Visual Studio Code (on a Mac) to write AngularJS style HTML. When I insert an inline expression for a CSS value, I get the annoying red Intellisense error, as shown in the screenshot below. Also, please note that I have disabled all extensions to ensure that none were the cause of my issue.

The main question is this: how do I disable the CSS errors in VSCode for Mac?

CSS Error in VSCode

Thanks for any suggestions!

Dumyat answered 16/6, 2018 at 4:36 Comment(2)
One suggestion, dont use {{}} in style attribure, it'll create bugs at any point of time. There might be some scenarios where your {{myCol}} will take sometime to render and at that time your style wont be applied. Use ng-style , similarly check for ng-hrefDungaree
Ah, I wasn't yet familiar with the ng-style directive. Thank you for the tip!Dumyat
B
7

open your settings.json file by cmd+shift+p OR crl+shift+p and typing setting.json

in that file add this line

"html.validate.styles": false
Bron answered 2/3, 2021 at 7:28 Comment(1)
This worked, but I only want it to work for .liquid files. Is there a way to set it so it works in all files except .liquid?Chafin
D
3

VSCode is still very new to me, but after some tinkering I found an option that disables all CSS validation rules. I set the value to false and the errors are now longer showing up. The setting in your settings.json file should appear as as follows:

    {
        "folders": [
            {
                "path": "/Users/Paulie/Desktop/AngularPractice"
            }
        ],
        "settings": {
            "css.validate": false
        }
    }
Dumyat answered 16/6, 2018 at 5:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.