Auditing rules to enforce best practices at runtime #795

Open
paulirish opened this Issue Mar 15, 2012 · 5 comments

4 participants

@paulirish

Seen lots of posts/talks about best practices of writing sass lately.. I feel like some of these could be codified and presented in compass to enforce these improvements better than a smattering of external posts.

Unanswered questions:

  • Which best practices can we detect?
  • Which should the tool recommend against?
  • CSSLint is quite configurable now; can we use it?
  • How to show these to the user? (On compile? Somehow less frequently?)
@chriseppstein
Compass member

Actually, compass 0.12 shows both sass and css filesize in the stats output.

One idea is that just printing the css filesize when compiling might actually have a dramatic end-user behavior effect (like showing the runtime gas mileage in a car).

We could also have a strict mode that would forbid certain bad behaviors like nesting more than 4 levels deep.

@paulirish

gzipped filesize would be better as it wipes out the cost of vendor prefixes, among other things. see also @necolas's latest post about CSS and gzip.

I've thought about using sparklines to indicate filesize growth over time.

Strict mode is a good idea, yeah.

@rvock

At my company, we have two callbacks in our config.rb: one that outputs the file size (normal and gziped) and one that outputs the selector and property count (and outputs a warning, if properties are above 4096 for IE -> see blesscss)

https://gist.github.com/2164668 (I am no ruby programmer... the selector count callback looks a bit hacky :P )

We just add this to every config.rb of our projects

(another callback is for generated sprites: it calles imgopt/optipng on the generated sprites)

@necolas

BTW, the 4096 IE bug for the number of rules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment