Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Resharper tell me a css class is unknown because it's on a CDN?

Resharper tells me, "Unknown css class 'container-fluid" for this line in my site's _SiteLayout.cshtml file:

<header class="container-fluid">"

I do have this in my <head> section:

<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.no-icons.min.css" rel="stylesheet">

...and I believe "container-fluid' is there. Is this simply a matter of Resharper not being able to find the class because it's remote?

like image 472
B. Clay Shannon-B. Crow Raven Avatar asked Jun 12 '13 14:06

B. Clay Shannon-B. Crow Raven


2 Answers

I was also having this issue using Resharper 8.2, tried Fizzix solution but I already had those options selected and it didn't seem to fix it :(

What did work, however, was a simple fix;

  • I right-clicked on the css file that contained the class it was telling me was unknown in my SOlution Explorer.
  • Selected 'Exclude from Project'
  • Right-clicked on file again and 'Include in Project'

Error went away instantly and page now renders with the css class correctly! Weird!

like image 139
IfElseTryCatch Avatar answered Sep 19 '22 19:09

IfElseTryCatch


ReSharper cannot access this file since it is not yet rendered into the project.

For example, when you have a CSS file within your project, ReSharper can simply search through it looking for class names. Although, when a CSS file is outside of your project (remote, or in a CDN), it does not have the capabilities to access it since it is not included yet.

Once your project is running within a browser and the file from the CDN is called, that is when it is included within your project.

Therefore, if you would like to know which class names exist or not when working with ReSharper, it is usually best to download them and include them within your project :)

EDIT:

After researching into this, I think I have found a way to allow ReSharper to search within external sources and uncompiled code.

Go to: ReSharper -> Options -> Tools -> External Sources

enter image description here

More information in the official documentation for ReSharper | Options | Tools | External Sources.

like image 23
Fizzix Avatar answered Sep 21 '22 19:09

Fizzix