|
1 | 1 | = ruby_css_lint |
2 | 2 |
|
3 | | -A repackaging of CSS Lint [https://github.com/stubbornella/csslint] for use with Rails. |
| 3 | +A repackaging of [CSS Lint](https://github.com/stubbornella/csslint) for use with Rails. |
4 | 4 |
|
5 | 5 | If you're using Rails 3.1, you probably want to run css lint on your precompiled assets. Compile them: |
6 | | -```ruby |
7 | | -rake assets:precompile |
8 | | -``` |
| 6 | + rake assets:precompile |
9 | 7 |
|
10 | 8 |
|
11 | 9 | To install Ruby CSS Lint, Add it to your gemfile |
12 | | -```ruby |
13 | | -gem 'ruby_css_lint' |
14 | | -``` |
15 | | -And after a bundle install, run it: |
16 | | -```ruby |
17 | | -rake css_lint:run |
18 | | -``` |
19 | | - |
20 | | -You probably want more control over things, so generate a config file: |
21 | | -```ruby |
22 | | -rake css_lint:generate_config |
23 | | -``` |
24 | | - |
25 | | -You will find the config file at ```config/initializers/css_lint.rb```. |
26 | | - |
27 | | -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```. |
| 10 | + gem 'ruby_css_lint' |
28 | 11 |
|
29 | | -```ruby |
30 | | -module RubyCssLint |
31 | | - def self.ruleset_classifications |
32 | | - { |
33 | | - "floats" => RubyCssLint::WARNING, |
34 | | - } |
35 | | - end |
| 12 | +And after a bundle install, run it: |
| 13 | + rake css_lint:run |
36 | 14 |
|
37 | | - def self.location_of_custom_rules(rails_root) |
38 | | - ["#{rails_root.to_s}/test/css_lint/*.js"] |
39 | | - end |
40 | 15 |
|
41 | | - def self.location_of_css_files(rails_root) |
42 | | - [rails_root.to_s+"/public/assets/application2.css"] |
| 16 | +You probably want more control over things, so generate a config file: |
| 17 | + rake css_lint:generate_config |
| 18 | + |
| 19 | +You will find the config file at config/initializers/css_lint.rb. |
| 20 | + |
| 21 | +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. |
| 22 | + |
| 23 | + module RubyCssLint |
| 24 | + def self.ruleset_classifications |
| 25 | + { |
| 26 | + "floats" => RubyCssLint::WARNING, |
| 27 | + } |
| 28 | + end |
| 29 | + |
| 30 | + def self.location_of_custom_rules(rails_root) |
| 31 | + ["#{rails_root.to_s}/test/css_lint/*.js"] |
| 32 | + end |
| 33 | + |
| 34 | + def self.location_of_css_files(rails_root) |
| 35 | + [rails_root.to_s+"/public/assets/application2.css"] |
| 36 | + end |
43 | 37 | end |
44 | | -end |
45 | | -``` |
46 | | - |
| 38 | + |
47 | 39 |
|
48 | 40 | == Copyright |
49 | 41 |
|
|
0 commit comments