Funktr0n
Funktr0n

Reputation: 1842

CSSLint: Ignore single line in CSS file?

I'm working with a CSS file that uses Mozilla's -moz-element(#element) directive for a background-image. The code looks like:

#foo {background-image: -moz-element(#element);}

When I run this through CSSLint, it tells me that the "Rule is empty", despite the fact that it's obviously not. I could attempt to run CSSLint via command line and use --ignore, but what I'm really looking for is a way to ignore just that single line from within my CSS file. Is there a way to do that?

And just for clarity, what I'm looking for is the analogue to how JSHint does things, which looks like this:

var notChecked = 'This line won't get checked'; // jshint ignore:line

Upvotes: 6

Views: 11857

Answers (4)

Robert Brisita
Robert Brisita

Reputation: 5844

One can also ignore sections with:

/* csslint ignore:start */
@import('normalize.css');
/* csslint ignore:end */

And also allow:

.foo.bar { /* csslint allow: adjoining-classes */
  margin: 0;
}

Upvotes: 0

peterorum
peterorum

Reputation: 1421

Using an embedded ruleset:

/*csslint important: false*/

.example {
  display: none ! important 
}

/*csslint important: true*/

Upvotes: 8

Funktr0n
Funktr0n

Reputation: 1842

CSSLint does not currently support a single-line ignore function from within a CSS file. Hopefully (would be awesome!) this changes in the future.

Upvotes: 2

Tom
Tom

Reputation: 74

In version 0.9.10+ you can use "embedded rulesets" directly in the CSS file.

If that doesn't work, you could try placing that line in a CSS comment, for example:

/* #foo {background-image: -moz-element(#element);} */

Upvotes: -2

Related Questions