I use Spring and have found this answer to similar question, however it not at all satisfactory since it requires changing project structure:
Get Eclipse to recognise CSS included via context in Spring MVC project
So the question is, can I somehow set Eclipse to ignore "Undefined CSS class" warning.
It's not just about Spring, I might have some CSS classes I use in JavaScript that are not present in CSS spreadsheet or any other reason. The warning is shown on every element on html that uses css class that it cannot find, say:
<div class="js-something">Something</div>
This class is not going to be defined in .css file since it is only used in JavaScript. Same thing with Spring where .css is connected with:
<link href="<c:url value='/css/style.css'/>" rel="stylesheet" type="text/css" />
Or in AngularJS project where html files are added with ng-include. This warning is really barely helpful, it probably should be even disabled by default. I've looked all through Eclipse settings but couldn't find any way to ignore this kind of warnings. Can anybody help me get rid of those?
Allright, I've found it. Funnily enough, it is under "Validation" if you edit project preferences, but not in overall preferences, that's why I couldn't find it when searching preferences by "Validation".
In project preferences: Web Resources -> Validation -> CSS
In overall preferences: Web -> HTML Files -> Web Resources -> CSS
Finally my projects are no longer riddled with yellow markers.
Related
I'm trying to upgrade a Plone 3.3.5 server to 4.3.6. However, when I update the site, I find that the CSS for the site is not carried over. If I go to my CSS Registry, I find that almost all of my CSS is producing the (resource not found or not accessible) error.
My confusion seems to be in how Plone locates and links/imports stylesheets in general as Plone seems to be loading virtually none of my CSS and pretty much giving me raw HTML in the browser. I'm assuming the CSS registry is loading CSS from the buildout-cache. With this assumption, an example stylesheet that I'm targeting is located under:
Plone/buildout-cache/eggs/Products.NuPlone-1.0b3-py2.7.egg/Products/NuPlone/skins/nuplone_styles/base.css
When the CSS Registry failed to load this, I noticed that some CSS was being loaded in via handles like this:
++resource++tinymce.stylesheets/tinymce.css
But this format doesn't work with base.css and others.
So my question is, given I've got a new product installed with some CSS included in it, how do I get Plone to target said CSS?
For resources inside "skins" FS folders, the way to register on portal_css tool is to simply provide the filename, so simply put there base.css.
If this is not working probably the nuplone_styles skin folder is not registered properly in the portal_skins tool.
So go to ZMI --> portal_skins --> click on "Properties" and check the following:
what theme is used? You must probably switch back to NuPlone (but I'm not sure if it works on Plone 4)
is the nuplone_styles folder in the list of CMF layers of the used theme?
Please note also that adding the nuplone_styles layer to another theme is not a good idea. Please think about copying CSS you need in the custom directory.
This is not an answer, but some additional explanation, not fitting in a comment:
The "old" way to include style-sheets via skin-folders, requires to specify only the file-name, not a full path, and will be found by traversal, meaning the first found file with the according name, will be taken. In case of several files with the same name, the order of skins matters.
The other way is to register style-sheets via a browser-package, to have an unambiguous path to a certain file, they must start with +++resource++.
I've just downloaded IntelliJ IDEA 15 and am having issues with CSS class autocomplete from linked stylesheets. An example is when I link Bootstrap's stylesheet in the header as shown below:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
The CSS classes don't autocomplete. The only way I've been able to achieve this is by actually attaching the stylesheet within my project. On the contrary, my JavaScript linked assets show correctly and can also be referenced within the project. I have downloaded most all of the necessary plugins including LiveEdit, Emmet, CSS-x-fire, and all other necessary tools.
If anyone can help me with this, it would be greatly appreciated. This software seems to be very robust and I'd like to continue using the IntelliJ product suite.
Consider to remove Web facet from your project module. (Open the project structure dialog) It helped me in similar situation.
We have the following line in our BundleConfig.cs
bundles.Add(new StyleBundle("~/css/global").Include("~/assets/css/global.css").Include("~/assets/css/global-custom.css"));
This is then used on our layout template like so
#Styles.Render("~/css/global")
In debug mode, the styles are all correct, as it just puts in links to the flat CSS files, but in release mode the optimisation takes place and we end up with a link like this
<link href="/css/global?v=JeCJ-mJfPPBREwlOCYDzyEG1VfJETaOYdJRHLkBLU9w1" rel="stylesheet">
But we end up with some style issues on the page.
Searching through the returned CSS shows that there are styles which the bundling has just not included at all. I have tried making the bundle only reference global.css (and not global-custom.css) with the same issue of styles from global.css not coming through.
I have looked at threads with other problems with the bundling and have tried solutions to those problems with no luck, and have not been able to find a similar problem online.
Does anybody know why this might be happening?
So far I can't find a question or fix for this. I'm sure it's something simple I'm missing.
I have a style bundle with a bunch of minified CSS, and I am decorating HTML elements with the classes inside. Everything is working great.
Intellisense and ReSharper however are both bugging me about the CSS the classes being unknown. I'm guessing this is because they cannot peek inside the bundles.
Question: Is there a way to fix this?
<!-- Style Bundles in HEAD tag-->
#Styles.Render("~/bundle/style/css")
#RenderSection("styles", false);
<!-- HTML elements in BODY tag: "row" is an unknown css class -->
<div class="row">
<p>Lorem ipsum</p>
</div>
Update: Visual Studio 2012. LESS conversion and intellisense works for single directly referenced files. My situation is that intellisense breaks when referencing a LESS bundle.
Update 2: Here's the code showing the BundleConfig.cs since it isnt clear
var customStyles = new Bundle("~/bundle/style/css")
.Include("~/Content/normalize.css","~/Content/*.less");
bootstrapStyles.Transforms.Add(new LessTransform());
bootstrapStyles.Transforms.Add(new CssMinify());
bundles.Add(customStyles);
Notice we are using Bundle not StyleBundle which is necessary because we want to specify the LessTransform() class and skip the built in CSS transformer. The LessTransform object is a custom object that simply reads in all the LESS content and concatenates it on a StringBuilder and then calls dotless's converter... out comes a huge CSS string that is minified and returned. The question is why cant VS or ReSharper peek at the returned CSS and help check class styles?
Here's a post on jetbrains blog. It's a bit out of date, but Jura went on record stating that there were no plans on supporting LESS (yet).
User:
Are there any plans to support LESS? I don’t care a whole lot about full support, but it would sure be nice if it could at least bring highlighting and code completion support into .less files and have it handle nested rules.
Jura Gorohovsky :
No, no such plans yet. Can you point me to a publicly available
project that uses LESS extensively so that we can take a look at it to
determine the scope of work?
Link
Late edit:
Web WorkBench from Mindscape may provide what some people coming to this thread are looking for. They are very response to bug fixes, and have been making some solid improvements to intellisense in the LESS world.
Have you installed the js extension to Visual Studio 2012? Go to Tools | Extensions and Updates and then SDKs if you have many installed.
Don't think the bundling has any affect on your intellisense, I've tried with and without and my intellisense is still there. Ensure you css stylesheet is included in your solution and maybe test with a more specific class, e.g. "onebeatconsumer" instead of "row" (there could be a clash somewhere with this)
If you are using LESS, this could most definitely be your issue as it visual might well not be able to parse LESS syntax as it only generates the full styles at runtime. Does styles in a standard css stylesheet work okay for you?
Whenever I am working in Visual Studio I always found that it will not resolve the css class names in my html. The CSS Class names will appear with the green squiggly line in Visual Studio but then the page will render fine when viewing it in the browser. So I know the css file is referenced correctly in my master page but Visual Studio is just failing to resolve it. Also the Design View will not show any of the css styles either.
See this post by Jeff King about getting Visual Studio to be able to find the javascript file with the intellisense: JScript IntelliSense FAQ.
In particular read point #4, third bullet:
Site-Relative Paths - These are paths
of the form "/folder/file", and is
calculated from the base of your site
(http://site/application/folder/file).
This approach is supported by ASP.NET
Web Forms and ASP.NET MVC. However,
it is not supported by Visual Studio.
The reason is because Visual Studio
does not always know the final
deployed location of your site and
thus the path resolution cannot be
guaranteed. Given that quite we've
seen few folks are using site-relative
paths, we could consider making an
assumption just resolving this type of
path to the root of the project.
Given the risk that you may think your
site is working when it's really not,
I wanted to see how many people were
supportive of this.
Notice the “[Site-Relative Paths are] NOT supported by Visual Studio”. I always use site relative paths for my javascript and css files so the solution to get Visual Studio to find your javascript files is the same solution to get Visual Studio to find your css files:
<link href="/content/default.css" rel="stylesheet" type="text/css" />
<% if (false) {%>
<link href="../../content/default.css" rel="stylesheet" type="text/css" />
<% } %>
And now Visual Studio can find the CSS file and validate my CSS Class names exist (and Design View looks so much better too).
Posted on my blog here:
Why does Visual Studio not resolve my CSS class names?
-Jeff
I just saw an answer to this, so I thought I'd share it.
You can get VS2008 to recognize your CSS file by going to the View/Manage Styles toolbar and adding your CSS file that way. When I did it I saw my CSS file in the Manage Styles list but it had a warning icon because VS couldn't see it for some reason. I deleted and re-added it, and now VS is finding my styles (no green error squiggle) and Intellisense is working. Much relieved!
Tried to just close the project and open it again? It might be that it's just a bit slow, or you're using some sort of path to the stylesheet (generated on basis of other data or whatever) that can't be read directly by VS.
Never experienced the same (VS08).