ruby_css_lint

A repackaging of [CSS Lint](github.com/stubbornella/csslint) for use with Rails.

If you’re using Rails 3.1, you probably want to run css lint on your precompiled assets. Compile them:

rake assets:precompile

To install Ruby CSS Lint, Add it to your gemfile

gem 'ruby_css_lint'

And after a bundle install, run it:

rake css_lint:run

You probably want more control over things, so generate a config file:

rake css_lint:generate_config

You will find the config file at config/initializers/css_lint.rb.

You can control the behavior of Ruby CSS Lint by modifying the implementation of the methods RubyCssLint::location_of_css_files, RubyCssLint::location_of_custom_rules and RubyCssLint::ruleset_classifications.

module RubyCssLint
  def self.ruleset_classifications
    {
      "floats" => RubyCssLint::WARNING,
    }
  end

  def self.location_of_custom_rules(rails_root)
    ["#{rails_root.to_s}/test/css_lint/*.js"]
  end

  def self.location_of_css_files(rails_root)
    [rails_root.to_s+"/public/assets/application.css"]
  end
end

Copyright © 2012 AppFolio, inc. See LICENSE.txt for further details.