csscss 1.3.2 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +1 -1
- data/CHANGELOG.md +5 -0
- data/Gemfile +10 -10
- data/Gemfile.lock +9 -11
- data/README.md +7 -0
- data/csscss.gemspec +1 -1
- data/lib/csscss.rb +0 -1
- data/lib/csscss/reporter.rb +1 -1
- data/lib/csscss/version.rb +1 -1
- data/test/csscss/reporter_test.rb +6 -6
- data/test/just_parse.rb +1 -1
- data/test/test_helper.rb +6 -6
- metadata +20 -15
- data/lib/csscss/parslet_optimizations.rb +0 -77
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29fe6b307cec72a8caa09c390e53c62bbc14e711
|
4
|
+
data.tar.gz: ea292f00371ff139241d08731f4e34c341bd7316
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a0f4b998370a3fe7f43b01c80ed8dd2b7e0cbcdfa614163545b5e1b6ae1ce165116eaed1d770819d4665c27c453ae63220e17f708dbdc50a158c47420d1bbce
|
7
|
+
data.tar.gz: af2c34e8c0d78c3a4a2e5cc8cb675c016532c472656f6e7fda95e91eef840e9aa06c9b62b14bb2edd06af1c1fddca86ae32773a34f68c3f49bf2f8e914bc4ae2
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-2.1.2
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## 1.3.3 - 5/30/2014 ##
|
2
|
+
|
3
|
+
* Upgrades parslet dependency to v1.6.1 and drops optimization monkeypatch
|
4
|
+
* Use correct terminology "declartions" instead of "rules" in the output
|
5
|
+
|
1
6
|
## 1.3.2 - 6/22/2013 ##
|
2
7
|
|
3
8
|
* Fixes attribute parsing bug that includes comments with braces
|
data/Gemfile
CHANGED
@@ -4,16 +4,16 @@ source 'https://rubygems.org'
|
|
4
4
|
gemspec
|
5
5
|
|
6
6
|
# optional runtime dependencies
|
7
|
-
gem
|
8
|
-
gem
|
9
|
-
gem
|
10
|
-
gem
|
7
|
+
gem 'sass'
|
8
|
+
gem 'compass'
|
9
|
+
gem 'less'
|
10
|
+
gem 'therubyracer', :platform => :mri
|
11
11
|
|
12
|
-
gem
|
13
|
-
gem
|
12
|
+
gem 'rake', :require => false
|
13
|
+
gem 'byebug'
|
14
14
|
|
15
|
-
gem
|
16
|
-
gem
|
17
|
-
gem
|
15
|
+
gem 'minitest'
|
16
|
+
gem 'm'
|
17
|
+
gem 'minitest-rg'
|
18
18
|
|
19
|
-
gem
|
19
|
+
gem 'ruby-prof'
|
data/Gemfile.lock
CHANGED
@@ -1,28 +1,26 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
csscss (1.3.
|
4
|
+
csscss (1.3.3)
|
5
5
|
colorize
|
6
|
-
parslet (
|
6
|
+
parslet (>= 1.6.1, < 2.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
11
|
blankslate (2.1.2.4)
|
12
|
+
byebug (3.1.2)
|
13
|
+
columnize (~> 0.8)
|
14
|
+
debugger-linecache (~> 1.2)
|
12
15
|
chunky_png (1.2.7)
|
13
|
-
colorize (0.
|
14
|
-
columnize (0.
|
16
|
+
colorize (0.7.3)
|
17
|
+
columnize (0.8.9)
|
15
18
|
commonjs (0.2.6)
|
16
19
|
compass (0.12.2)
|
17
20
|
chunky_png (~> 1.2)
|
18
21
|
fssm (>= 0.2.7)
|
19
22
|
sass (~> 3.1)
|
20
|
-
debugger (1.6.0)
|
21
|
-
columnize (>= 0.3.1)
|
22
|
-
debugger-linecache (~> 1.2.0)
|
23
|
-
debugger-ruby_core_source (~> 1.2.1)
|
24
23
|
debugger-linecache (1.2.0)
|
25
|
-
debugger-ruby_core_source (1.2.2)
|
26
24
|
fssm (0.2.10)
|
27
25
|
less (2.3.1)
|
28
26
|
commonjs (~> 0.2.6)
|
@@ -33,7 +31,7 @@ GEM
|
|
33
31
|
method_source (0.8.1)
|
34
32
|
minitest (2.12.1)
|
35
33
|
minitest-rg (1.1.0)
|
36
|
-
parslet (1.
|
34
|
+
parslet (1.6.1)
|
37
35
|
blankslate (~> 2.0)
|
38
36
|
rake (10.0.3)
|
39
37
|
ref (1.0.4)
|
@@ -47,9 +45,9 @@ PLATFORMS
|
|
47
45
|
ruby
|
48
46
|
|
49
47
|
DEPENDENCIES
|
48
|
+
byebug
|
50
49
|
compass
|
51
50
|
csscss!
|
52
|
-
debugger
|
53
51
|
less
|
54
52
|
m
|
55
53
|
minitest
|
data/README.md
CHANGED
@@ -63,6 +63,13 @@ LESS requires an additional javascript runtime.
|
|
63
63
|
rubies, and [therubyrhino](https://rubygems.org/gems/therubyrhino) on
|
64
64
|
jruby.
|
65
65
|
|
66
|
+
## Are there any community extensions? ##
|
67
|
+
|
68
|
+
* [compass-csscss](https://github.com/Comcast/compass-csscss) integrates csscss with [compass](http://compass-style.org/) projects.
|
69
|
+
* [grunt-csscss](https://github.com/peterkeating/grunt-csscss) a [grunt](http://gruntjs.com/) task to automatically run csscss.
|
70
|
+
|
71
|
+
_Please submit [an issue](https://github.com/zmoazeni/csscss/issues/new) if you know of any others._
|
72
|
+
|
66
73
|
## Why doesn't csscss automatically remove duplications for me? ##
|
67
74
|
|
68
75
|
I have been asked this a lot, but csscss is intentionally designed this
|
data/csscss.gemspec
CHANGED
data/lib/csscss.rb
CHANGED
data/lib/csscss/reporter.rb
CHANGED
@@ -13,7 +13,7 @@ module Csscss
|
|
13
13
|
selector_groups = selector_groups.map {|selectors| "{#{maybe_color(selectors, :red, should_color)}}" }
|
14
14
|
last_selector = selector_groups.pop
|
15
15
|
count = declarations.size
|
16
|
-
io.puts %Q(#{selector_groups.join(", ")} AND #{last_selector} share #{maybe_color(count, :red, should_color)}
|
16
|
+
io.puts %Q(#{selector_groups.join(", ")} AND #{last_selector} share #{maybe_color(count, :red, should_color)} declaration#{"s" if count > 1})
|
17
17
|
if verbose
|
18
18
|
declarations.each {|dec| io.puts(" - #{maybe_color(dec, :yellow, should_color)}") }
|
19
19
|
end
|
data/lib/csscss/version.rb
CHANGED
@@ -12,19 +12,19 @@ module Csscss
|
|
12
12
|
})
|
13
13
|
|
14
14
|
expected =<<-EXPECTED
|
15
|
-
{.foo} AND {.bar} share 2
|
16
|
-
{h1, h2}, {.foo} AND {.baz} share 1
|
17
|
-
{h1, h2} AND {.bar} share 1
|
15
|
+
{.foo} AND {.bar} share 2 declarations
|
16
|
+
{h1, h2}, {.foo} AND {.baz} share 1 declaration
|
17
|
+
{h1, h2} AND {.bar} share 1 declaration
|
18
18
|
EXPECTED
|
19
19
|
reporter.report(color:false).must_equal expected
|
20
20
|
|
21
21
|
expected =<<-EXPECTED
|
22
|
-
{.foo} AND {.bar} share 2
|
22
|
+
{.foo} AND {.bar} share 2 declarations
|
23
23
|
- width: 1px
|
24
24
|
- border: black
|
25
|
-
{h1, h2}, {.foo} AND {.baz} share 1
|
25
|
+
{h1, h2}, {.foo} AND {.baz} share 1 declaration
|
26
26
|
- display: none
|
27
|
-
{h1, h2} AND {.bar} share 1
|
27
|
+
{h1, h2} AND {.bar} share 1 declaration
|
28
28
|
- position: relative
|
29
29
|
EXPECTED
|
30
30
|
reporter.report(verbose:true, color:false).must_equal expected
|
data/test/just_parse.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
3
|
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
4
|
+
require 'minitest/autorun'
|
5
|
+
require 'minitest/rg'
|
6
|
+
require 'byebug'
|
7
7
|
|
8
|
-
require
|
8
|
+
require 'csscss'
|
9
9
|
|
10
10
|
module TypeHelpers
|
11
11
|
def sel(s)
|
metadata
CHANGED
@@ -1,41 +1,47 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: csscss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zach Moazeni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parslet
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.6.1
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '2.0'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- -
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.6.1
|
30
|
+
- - "<"
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
32
|
+
version: '2.0'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: colorize
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
|
-
- -
|
37
|
+
- - ">="
|
32
38
|
- !ruby/object:Gem::Version
|
33
39
|
version: '0'
|
34
40
|
type: :runtime
|
35
41
|
prerelease: false
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
|
-
- -
|
44
|
+
- - ">="
|
39
45
|
- !ruby/object:Gem::Version
|
40
46
|
version: '0'
|
41
47
|
description: csscss will parse any CSS files you give it and let you know which rulesets
|
@@ -47,9 +53,9 @@ executables:
|
|
47
53
|
extensions: []
|
48
54
|
extra_rdoc_files: []
|
49
55
|
files:
|
50
|
-
- .gitignore
|
51
|
-
- .ruby-version
|
52
|
-
- .travis.yml
|
56
|
+
- ".gitignore"
|
57
|
+
- ".ruby-version"
|
58
|
+
- ".travis.yml"
|
53
59
|
- CHANGELOG.md
|
54
60
|
- CONTRIBUTING.md
|
55
61
|
- CONTRIBUTORS.md
|
@@ -79,7 +85,6 @@ files:
|
|
79
85
|
- lib/csscss/parser/multi_side_transformer.rb
|
80
86
|
- lib/csscss/parser/outline.rb
|
81
87
|
- lib/csscss/parser/padding.rb
|
82
|
-
- lib/csscss/parslet_optimizations.rb
|
83
88
|
- lib/csscss/redundancy_analyzer.rb
|
84
89
|
- lib/csscss/reporter.rb
|
85
90
|
- lib/csscss/sass_include_extensions.rb
|
@@ -115,17 +120,17 @@ require_paths:
|
|
115
120
|
- lib
|
116
121
|
required_ruby_version: !ruby/object:Gem::Requirement
|
117
122
|
requirements:
|
118
|
-
- -
|
123
|
+
- - ">="
|
119
124
|
- !ruby/object:Gem::Version
|
120
125
|
version: '1.9'
|
121
126
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
127
|
requirements:
|
123
|
-
- -
|
128
|
+
- - ">="
|
124
129
|
- !ruby/object:Gem::Version
|
125
130
|
version: '0'
|
126
131
|
requirements: []
|
127
132
|
rubyforge_project:
|
128
|
-
rubygems_version: 2.
|
133
|
+
rubygems_version: 2.2.2
|
129
134
|
signing_key:
|
130
135
|
specification_version: 4
|
131
136
|
summary: A CSS redundancy analyzer that analyzes redundancy.
|
@@ -1,77 +0,0 @@
|
|
1
|
-
# These are my multibyte optimizations for parslet.
|
2
|
-
# More information can be found:
|
3
|
-
# https://github.com/kschiess/parslet/issues/73
|
4
|
-
# https://github.com/kschiess/parslet/pull/74
|
5
|
-
# https://github.com/zmoazeni/parslet/tree/optimized-multibyte-parsing
|
6
|
-
|
7
|
-
require 'strscan'
|
8
|
-
require 'forwardable'
|
9
|
-
|
10
|
-
module Parslet
|
11
|
-
class Source
|
12
|
-
extend Forwardable
|
13
|
-
|
14
|
-
def initialize(str)
|
15
|
-
raise ArgumentError unless str.respond_to?(:to_str)
|
16
|
-
|
17
|
-
@str = StringScanner.new(str)
|
18
|
-
|
19
|
-
@line_cache = LineCache.new
|
20
|
-
@line_cache.scan_for_line_endings(0, str)
|
21
|
-
end
|
22
|
-
|
23
|
-
def matches?(pattern)
|
24
|
-
regexp = pattern.is_a?(String) ? Regexp.new(Regexp.escape(pattern)) : pattern
|
25
|
-
!@str.match?(regexp).nil?
|
26
|
-
end
|
27
|
-
alias match matches?
|
28
|
-
|
29
|
-
def consume(n)
|
30
|
-
original_pos = @str.pos
|
31
|
-
slice_str = n.times.map { @str.getch }.join
|
32
|
-
slice = Parslet::Slice.new(
|
33
|
-
slice_str,
|
34
|
-
original_pos,
|
35
|
-
@line_cache)
|
36
|
-
|
37
|
-
return slice
|
38
|
-
end
|
39
|
-
|
40
|
-
def chars_left
|
41
|
-
@str.rest_size
|
42
|
-
end
|
43
|
-
|
44
|
-
def_delegator :@str, :pos
|
45
|
-
def pos=(n)
|
46
|
-
if n > @str.string.bytesize
|
47
|
-
@str.pos = @str.string.bytesize
|
48
|
-
else
|
49
|
-
@str.pos = n
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
|
54
|
-
class LineCache
|
55
|
-
def scan_for_line_endings(start_pos, buf)
|
56
|
-
return unless buf
|
57
|
-
|
58
|
-
buf = StringScanner.new(buf)
|
59
|
-
return unless buf.exist?(/\n/)
|
60
|
-
|
61
|
-
## If we have already read part or all of buf, we already know about
|
62
|
-
## line ends in that portion. remove it and correct cur (search index)
|
63
|
-
if @last_line_end && start_pos < @last_line_end
|
64
|
-
# Let's not search the range from start_pos to last_line_end again.
|
65
|
-
buf.pos = @last_line_end - start_pos
|
66
|
-
end
|
67
|
-
|
68
|
-
## Scan the string for line endings; store the positions of all endings
|
69
|
-
## in @line_ends.
|
70
|
-
while buf.skip_until(/\n/)
|
71
|
-
@last_line_end = start_pos + buf.pos
|
72
|
-
@line_ends << @last_line_end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|