compass-selector-warn 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 30371464761f3800a5a916d4fb0646506d22735e
4
- data.tar.gz: a618deee46e4da1c3ac7a8afa67c1e94e1388209
3
+ metadata.gz: 2f9a9d542f9d7eef658d7f6322e7247993f9fedf
4
+ data.tar.gz: c5684a1ec93ad2ffd1a04ba69f34b1f494e9aa8a
5
5
  SHA512:
6
- metadata.gz: af20e3c83177c813f82a63183a6b50d33f8f38fccc1339de2db6691d5e4d5f3ceb483e6af0759921f5b6539d3b7ea47a06540213acbacb374822d80e3affafc7
7
- data.tar.gz: 172b945c26cec6c107fd9917edc8cbc3a48183ec358383a00cba07654c0bf34070ceab87705d005446fb044835d9b5115b377df2e4ef6e3dcb2debfb73f82a44
6
+ metadata.gz: 2062e23d701bdea127f6dd546b36a4f9802d8ceb041d2aa5ee9e82df5d227b71d33d66c54934ba55128e185bd8a86db1ac22c5daaa814d99a63681c96c6ef9b6
7
+ data.tar.gz: 29eab163fdc6ab94b11928cccefb03ae53c4a3f0a5694aa4164c1a6b903f2bd69a8b2871f2fbf1ad967b640322fb2205fdc53b986c68ec6192a748a53c3ae715
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # compass-selector-warn
2
2
  ============
3
3
 
4
+ [![Build Status](https://travis-ci.org/pixel-shock/compass-selector-warn.png?branch=master)](https://travis-ci.org/pixel-shock/compass-selector-warn)
5
+
4
6
  This is a [compass](http://www.compass-style.org/ "compass") extension that warns you if you're using to many css selectors.
5
7
 
6
8
  ## Installation
@@ -12,7 +14,7 @@ Just go to your terminal an type this
12
14
  In your compass config file add this line
13
15
 
14
16
  require "compass-selector-warn"
15
-
17
+
16
18
  ### since v0.2
17
19
  Since v0.2 you can add this lines to your compass config file **to adjust the warning threshold** and **the warning text**.
18
20
 
@@ -10,7 +10,8 @@ include CssParser
10
10
  extend Compass::Actions
11
11
 
12
12
  # SET LOGGER COLOR
13
- Compass::Logger::ACTION_COLORS[:"too many selectors"] = :red
13
+ Compass::Logger::ACTION_COLORS[:warning] = :red
14
+ Compass::Logger::ACTION_COLORS[:"info"] = :yellow
14
15
 
15
16
  # Relativizing a path requires us to specify the working path.
16
17
  def working_path
@@ -21,6 +22,7 @@ config = CompassConfigParser.new(Compass.detect_configuration_file)
21
22
  selector_warn_max = config.get_param('selector_warn_max', 4096).to_i
22
23
  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
24
  warning_txt = warning_txt.gsub(/\#\{selector_warn_max\}/, selector_warn_max.to_s)
25
+ force_count = config.get_param('selector_warn_force',false);
24
26
 
25
27
  # CREATE THE PARSER
26
28
  Compass.configuration.on_stylesheet_saved do |css_file|
@@ -31,13 +33,15 @@ Compass.configuration.on_stylesheet_saved do |css_file|
31
33
  prop_count = 0
32
34
 
33
35
  parser.each_selector do |selector, declarations, specificity|
34
- sels = selector.split(/,/).size
35
- props = declarations.split(/;/).size
36
- selector_count += sels
37
- prop_count += props
36
+ sels = selector.split(/,/).size
37
+ props = declarations.split(/;/).size
38
+ selector_count += sels
39
+ prop_count += props
38
40
  end
39
41
 
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)
42
- end
43
- end
42
+ if selector_count >= selector_warn_max
43
+ Compass::Logger.new.record(:warning, "\t#{selector_count} selectors in #{relativize(css_file)}" + "\n\t\t" + warning_txt)
44
+ elsif force_count == "true"
45
+ Compass::Logger.new.record(:info, "#{selector_count} selectors in #{relativize(css_file)}")
46
+ end
47
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: compass-selector-warn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
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-15 00:00:00.000000000 Z
11
+ date: 2014-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: compass