20

I'm developing in Visual Studio 2013 Premium along with Web Essentials 2013 (update 4) an MVC 5 application with LESS for my CSS preprocessor. Web Essentials automatically compiles the files upon saving of the .less file.

The issue I am having is when I create a new HTML element with a class (or id) and then add that class to my .less file with some styles in it, Intellisense does not pick up the change & that the CSS class in the HTML has a corresponding CSS class in my .less stylesheet, therefore it says Unknown CSS class 'name-of-the-class'. So for example:

My HTML in my view

<div class="name-of-class"></div>

CSS in my .less file

.name-of-class {
    color: #000;
}

It doesn't seem to recognize that I added the class in either place, likely because LESS compiles on save and Intellisense doesn't pick up the change.

I have tried:

  • Closing the files and reopening them after I add the HTML and CSS
  • Rebuilding and re-running the solution
  • Currently I'm using bundles for attaching my CSS to the page, but instead of bundling the compiled LESS I used a <link href="app.css"/> element directly in the <head> of my HTML file pointing to the compiled LESS file.

An image of the issue I see is below:

intellisense error

james
  • 5,006
  • 8
  • 39
  • 64
  • Have you tried changing any of the intellisense options under `Tools> Options> Web Essentials > CSS`? – Colin Bacon Feb 06 '15 at 15:19
  • @ColinBacon unfortunately it doesn't look like any of the Intellisense options in the Web Essentials section will help out in this case. It seems like those are more for when I'm actually in the `.css` file itself. Thank you for pointing those out though! – james Feb 06 '15 at 15:53
  • 3
    A little late to the party but this warning is triggered by ReSharper extension. Not sure if you can turn this feature off without disabling ReSharper completely. – karlingen Sep 05 '17 at 11:53
  • ReSharper has settings for *everything* - while you can't load a third-party asset URL, you can disable this specific warning under **Code Inspection > Inspection Severity > CSS > Potential Code Quality Issues > Unknown CSS class**. – qJake Mar 08 '22 at 17:30

0 Answers0