CSS Master

(Primo) #1

■ selectorordeclarationatfault


CSSLintprintsoutputtotheterminalwindow.Ifyou’drathersaveitasafile,use
theredirectionoperator.Thisappliestomostsystems,whetherLinux,OSX,or
Windows:


csslint stylesheet.css > csslintoutput.txt

CSSLintisalsoconfigurable;youcandisablechecksforanyofitsrulesbyusing
the--ignoreflag.Saythatyou’vefinallydroppedsupportforInternetExplorer 6
and7.YoucantellCSSLinttoignorethebox-sizingrulebypassing--ignore=box-
sizingasanargument:


csslint /path/to/stylesheet.css --ignore=box-sizing

CSSLintismorepragmaticthanbleedingedge.Itwillraisevendor-prefixwarnings
forpropertiessuchastransitionsthatyoumaynotneedtoinclude,dependingon
thebrowserdistributionofyoursite’saudience.Ifyoursite’svisitorsusemodern
browsers,youmaybeabletodisablethefollowingrules:


■ gradients
■ box-sizing
■ compatible-vendor-prefixes
■ fallback-colors(enableifyoustillhaveasignificantshareofIE8users)


Toviewalistofruleidentifiersandwhattheymean,usecsslint --list-rules.
Typecsslint --helpforthefullmenuofCSSLintoptions.Formorein-depth
documentation,consulttheCSSLintWiki.^7


analyze-css


LikeCSSLint,analyze-cssinspectsyourCSSforcomplexityandperformance.It
doesnot,however,checkforaccessibilityorcompatibility.Instead,itproducesa
seriesofmetricsandoffendingselectorsthatyoushouldexaminefurther.


(^7) https://github.com/CSSLint/CSSLint/wiki
Debugging and Optimization 123

Free download pdf