compass-selector-warn 0.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ab51e66e5fe43880ffd4945706ab0ecdb542818d
4
- data.tar.gz: 172b9c81f42e0326b62d55ed582adb39e6d0fde3
3
+ metadata.gz: 30371464761f3800a5a916d4fb0646506d22735e
4
+ data.tar.gz: a618deee46e4da1c3ac7a8afa67c1e94e1388209
5
5
  SHA512:
6
- metadata.gz: e551087cb331fa5114f7c6fd8e906364fc80b7ca84d5b8c8c83358cd0bda0f4b876b9bd30a20723aaadae274f612648c99c608f03d94a74d735402aa24932a6e
7
- data.tar.gz: 97bd1c870e403fa4ccaa809cbb90cc3238431a5f922f3e2b0208d4c8953f9c3c9af2ee6b1c24e3e3204b0e91b9171b6f23ba605a0bc976efbc9374d645f55dbf
6
+ metadata.gz: af20e3c83177c813f82a63183a6b50d33f8f38fccc1339de2db6691d5e4d5f3ceb483e6af0759921f5b6539d3b7ea47a06540213acbacb374822d80e3affafc7
7
+ data.tar.gz: 172b945c26cec6c107fd9917edc8cbc3a48183ec358383a00cba07654c0bf34070ceab87705d005446fb044835d9b5115b377df2e4ef6e3dcb2debfb73f82a44
data/README.md CHANGED
@@ -12,6 +12,14 @@ Just go to your terminal an type this
12
12
  In your compass config file add this line
13
13
 
14
14
  require "compass-selector-warn"
15
+
16
+ ### since v0.2
17
+ Since v0.2 you can add this lines to your compass config file **to adjust the warning threshold** and **the warning text**.
18
+
19
+ The **default-value is 4096** if you don't set this var in your config.
20
+
21
+ selector_warn_max = 4096
22
+ selector_warn_txt = "According to IE 6-9 architecture, maximum number of CSS selectors in one file is #{selector_warn_max}."
15
23
 
16
24
  ## Note
17
25
  This is one of my first compass extension, so if you have some annotations don't hesitate and write it here.
@@ -1,6 +1,7 @@
1
1
  # REQUIREMENTS
2
2
  require 'compass'
3
3
  require 'css_parser'
4
+ require 'compass-configparser'
4
5
 
5
6
  # INCLUDES
6
7
  include CssParser
@@ -11,15 +12,16 @@ extend Compass::Actions
11
12
  # SET LOGGER COLOR
12
13
  Compass::Logger::ACTION_COLORS[:"too many selectors"] = :red
13
14
 
14
- # CUSTOM VARS
15
- max_sel_count = 4096
16
- warning_txt = "\n\tAccording to IE 6-9 architecture, maximum number of CSS selectors in one file is #{max_sel_count}."
17
-
18
15
  # Relativizing a path requires us to specify the working path.
19
16
  def working_path
20
17
  Dir.pwd
21
18
  end
22
19
 
20
+ config = CompassConfigParser.new(Compass.detect_configuration_file)
21
+ selector_warn_max = config.get_param('selector_warn_max', 4096).to_i
22
+ warning_txt = config.get_param('selector_warn_txt', "According to IE 6-9 architecture, maximum number of CSS selectors in one file is #{selector_warn_max}.")
23
+ warning_txt = warning_txt.gsub(/\#\{selector_warn_max\}/, selector_warn_max.to_s)
24
+
23
25
  # CREATE THE PARSER
24
26
  Compass.configuration.on_stylesheet_saved do |css_file|
25
27
  contents = File.read(css_file)
@@ -35,7 +37,7 @@ Compass.configuration.on_stylesheet_saved do |css_file|
35
37
  prop_count += props
36
38
  end
37
39
 
38
- if selector_count > max_sel_count
39
- Compass::Logger.new.record(:"too many selectors", " => #{selector_count} => in file #{relativize(css_file)}" + warning_txt)
40
+ if selector_count > selector_warn_max
41
+ Compass::Logger.new.record(:"too many selectors", " => #{selector_count} => in file #{relativize(css_file)}" + "\n\t" + warning_txt)
40
42
  end
41
43
  end
metadata CHANGED
@@ -1,29 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: compass-selector-warn
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tino Wehe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-01-10 00:00:00.000000000 Z
11
+ date: 2013-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: compass
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 0.12.2
19
+ version: '0.12'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: 0.12.2
26
+ version: '0.12'
27
+ - !ruby/object:Gem::Dependency
28
+ name: compass-configparser
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '0.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '0.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: css_parser
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
27
55
  description: compass extension that warns you if you're using to many css selectors
28
56
  email: tino.wehe@brandrockers.com
29
57
  executables: []
@@ -53,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
53
81
  version: '0'
54
82
  requirements: []
55
83
  rubyforge_project:
56
- rubygems_version: 2.0.3
84
+ rubygems_version: 2.2.1
57
85
  signing_key:
58
86
  specification_version: 4
59
87
  summary: compass extension that warns you if you're using to many css selectors