css_splitter 0.0.2 → 0.1.0
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.
- data/MIT-LICENSE +1 -1
- data/README.md +53 -10
- data/lib/css_splitter/splitter.rb +2 -46
- data/lib/css_splitter/version.rb +1 -1
- data/test/dummy/app/assets/stylesheets/test_stylesheet_with_media_queries.css +19145 -0
- data/test/dummy/app/assets/stylesheets/test_stylesheet_with_media_queries_split2.css.split2 +1 -0
- data/test/dummy/app/assets/stylesheets/too_big_stylesheet.css.scss +4 -0
- data/test/dummy/config/environments/production.rb +1 -1
- data/test/dummy/log/development.log +202 -0
- data/test/dummy/log/production.log +206 -0
- data/test/dummy/tmp/cache/assets/C66/170/sprockets%2F0830b343f8968ec4aa8370f868668248 +0 -0
- data/test/dummy/tmp/cache/assets/CBA/E20/sprockets%2F50f31c73e7bf4e4615292f7f386c9026 +0 -0
- data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/CFB/3F0/sprockets%2Fc5701cb90862b1e1da20a31c93180ff8 +0 -0
- data/test/dummy/tmp/cache/assets/CFC/990/sprockets%2F87aeb2d2c5f12012d6d908b3a3466b12 +0 -0
- data/test/dummy/tmp/cache/assets/D10/120/sprockets%2Fc42700fc2e334676ada28a968f262ed6 +0 -0
- data/test/dummy/tmp/cache/assets/D23/170/sprockets%2F45f2cb247bdf9a5c97748e3f0897822a +0 -0
- data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/D35/500/sprockets%2F45b349f1b8c8016ce45eac3aa5e63531 +0 -0
- data/test/dummy/tmp/cache/assets/D43/540/sprockets%2Fa296fc4bd718f6277c297b142bc3b58a +0 -0
- data/test/dummy/tmp/cache/assets/D44/640/sprockets%2F12084178a650e7df6c4b71baf988c5ea +0 -0
- data/test/dummy/tmp/cache/assets/D45/010/sprockets%2Fe5609c41f6effb12ebf399a01337457e +0 -0
- data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/D9E/DF0/sprockets%2F5c364cce43467cca51d7fee41b38b8d2 +0 -0
- data/test/dummy/tmp/cache/assets/DA2/FD0/sprockets%2F72ac2ef2ba1cb3e39d55428df6356ef8 +0 -0
- data/test/dummy/tmp/cache/assets/DB7/EE0/sprockets%2F32bab925c6af34ffea7c025aa09d511a +0 -0
- data/test/dummy/tmp/cache/assets/E32/A40/sprockets%2F5964a02e2bf7bc79ebffb414bfb6df5c +0 -0
- data/test/dummy/tmp/cache/sass/e89c44a583723860dc69c83f73f8c6d9513c313c/too_big_stylesheet.css.scssc +0 -0
- data/test/unit/splitter_test.rb +19 -3
- metadata +45 -13
- data/app/assets/javascripts/css_splitter/application.js +0 -15
- data/app/assets/stylesheets/css_splitter/application.css +0 -13
- data/app/controllers/css_splitter/application_controller.rb +0 -4
- data/app/views/layouts/css_splitter/application.html.erb +0 -14
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/helpers/tests_helper.rb +0 -2
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/test/dummy/tmp/cache/sass/e89c44a583723860dc69c83f73f8c6d9513c313c/too_big_stylesheet.css.scssc
ADDED
Binary file
|
data/test/unit/splitter_test.rb
CHANGED
@@ -2,12 +2,12 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class CssSplitterTest < ActiveSupport::TestCase
|
4
4
|
test "#count_selectors" do
|
5
|
-
assert_equal CssSplitter::Splitter.count_selectors('test/unit/too_many_selectors.css')
|
5
|
+
assert_equal 2938, CssSplitter::Splitter.count_selectors('test/unit/too_many_selectors.css')
|
6
6
|
end
|
7
7
|
|
8
8
|
test "#count_selectors_of_rule" do
|
9
|
-
assert_equal CssSplitter::Splitter.count_selectors_of_rule('foo { color: baz; }')
|
10
|
-
assert_equal CssSplitter::Splitter.count_selectors_of_rule('foo, bar { color: baz; }')
|
9
|
+
assert_equal 1, CssSplitter::Splitter.count_selectors_of_rule('foo { color: baz; }')
|
10
|
+
assert_equal 2, CssSplitter::Splitter.count_selectors_of_rule('foo, bar { color: baz; }')
|
11
11
|
end
|
12
12
|
|
13
13
|
# --- split_string_into_rules ---
|
@@ -43,4 +43,20 @@ class CssSplitterTest < ActiveSupport::TestCase
|
|
43
43
|
first_rule = '@charset "UTF-8"; .foo { color: black; }'
|
44
44
|
assert_equal ['@charset "UTF-8";', ' .foo { color: black; }'], CssSplitter::Splitter.send(:extract_charset, first_rule)
|
45
45
|
end
|
46
|
+
|
47
|
+
# --- split_string ---
|
48
|
+
|
49
|
+
test '#split_string to get the second split' do
|
50
|
+
assert_equal "@charset \"UTF-8\";\n#test { background-color: green ;}", CssSplitter::Splitter.split_string(File.read('test/dummy/app/assets/stylesheets/too_big_stylesheet.css.scss'), 2)
|
51
|
+
end
|
52
|
+
|
53
|
+
# --- strip_comments ---
|
54
|
+
|
55
|
+
test '#strip_comments: strip single line CSS coment' do
|
56
|
+
assert_equal ".foo { color: black; }\n.foo { color: black; }", CssSplitter::Splitter.send(:strip_comments, ".foo { color: black; }\n/* comment */.foo { color: black; }")
|
57
|
+
end
|
58
|
+
|
59
|
+
test '#strip_comments: strip multiline CSS coment' do
|
60
|
+
assert_equal ".foo { color: black; }\n.foo { color: black; }", CssSplitter::Splitter.send(:strip_comments, ".foo { color: black; }\n/* multi\nline\ncomment */.foo { color: black; }")
|
61
|
+
end
|
46
62
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: css_splitter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-07-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -37,11 +37,7 @@ executables: []
|
|
37
37
|
extensions: []
|
38
38
|
extra_rdoc_files: []
|
39
39
|
files:
|
40
|
-
- app/views/layouts/css_splitter/application.html.erb
|
41
|
-
- app/controllers/css_splitter/application_controller.rb
|
42
40
|
- app/helpers/css_splitter/application_helper.rb
|
43
|
-
- app/assets/javascripts/css_splitter/application.js
|
44
|
-
- app/assets/stylesheets/css_splitter/application.css
|
45
41
|
- config/routes.rb
|
46
42
|
- lib/css_splitter/version.rb
|
47
43
|
- lib/css_splitter/splitter.rb
|
@@ -63,11 +59,29 @@ files:
|
|
63
59
|
- test/dummy/app/views/layouts/application.html.erb
|
64
60
|
- test/dummy/app/controllers/tests_controller.rb
|
65
61
|
- test/dummy/app/controllers/application_controller.rb
|
66
|
-
- test/dummy/app/
|
67
|
-
- test/dummy/app/helpers/tests_helper.rb
|
62
|
+
- test/dummy/app/assets/stylesheets/test_stylesheet_with_media_queries_split2.css.split2
|
68
63
|
- test/dummy/app/assets/stylesheets/too_big_stylesheet_split2.css.split2
|
64
|
+
- test/dummy/app/assets/stylesheets/test_stylesheet_with_media_queries.css
|
69
65
|
- test/dummy/app/assets/stylesheets/application.css
|
70
66
|
- test/dummy/app/assets/stylesheets/too_big_stylesheet.css.scss
|
67
|
+
- test/dummy/tmp/cache/sass/e89c44a583723860dc69c83f73f8c6d9513c313c/too_big_stylesheet.css.scssc
|
68
|
+
- test/dummy/tmp/cache/assets/D44/640/sprockets%2F12084178a650e7df6c4b71baf988c5ea
|
69
|
+
- test/dummy/tmp/cache/assets/E32/A40/sprockets%2F5964a02e2bf7bc79ebffb414bfb6df5c
|
70
|
+
- test/dummy/tmp/cache/assets/D23/170/sprockets%2F45f2cb247bdf9a5c97748e3f0897822a
|
71
|
+
- test/dummy/tmp/cache/assets/D45/010/sprockets%2Fe5609c41f6effb12ebf399a01337457e
|
72
|
+
- test/dummy/tmp/cache/assets/C66/170/sprockets%2F0830b343f8968ec4aa8370f868668248
|
73
|
+
- test/dummy/tmp/cache/assets/D35/500/sprockets%2F45b349f1b8c8016ce45eac3aa5e63531
|
74
|
+
- test/dummy/tmp/cache/assets/DA2/FD0/sprockets%2F72ac2ef2ba1cb3e39d55428df6356ef8
|
75
|
+
- test/dummy/tmp/cache/assets/CBA/E20/sprockets%2F50f31c73e7bf4e4615292f7f386c9026
|
76
|
+
- test/dummy/tmp/cache/assets/D43/540/sprockets%2Fa296fc4bd718f6277c297b142bc3b58a
|
77
|
+
- test/dummy/tmp/cache/assets/DB7/EE0/sprockets%2F32bab925c6af34ffea7c025aa09d511a
|
78
|
+
- test/dummy/tmp/cache/assets/CFC/990/sprockets%2F87aeb2d2c5f12012d6d908b3a3466b12
|
79
|
+
- test/dummy/tmp/cache/assets/D9E/DF0/sprockets%2F5c364cce43467cca51d7fee41b38b8d2
|
80
|
+
- test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6
|
81
|
+
- test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705
|
82
|
+
- test/dummy/tmp/cache/assets/D10/120/sprockets%2Fc42700fc2e334676ada28a968f262ed6
|
83
|
+
- test/dummy/tmp/cache/assets/CFB/3F0/sprockets%2Fc5701cb90862b1e1da20a31c93180ff8
|
84
|
+
- test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953
|
71
85
|
- test/dummy/script/rails
|
72
86
|
- test/dummy/Rakefile
|
73
87
|
- test/dummy/public/404.html
|
@@ -107,7 +121,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
121
|
version: '0'
|
108
122
|
segments:
|
109
123
|
- 0
|
110
|
-
hash:
|
124
|
+
hash: 4362279711177264786
|
111
125
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
126
|
none: false
|
113
127
|
requirements:
|
@@ -116,10 +130,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
130
|
version: '0'
|
117
131
|
segments:
|
118
132
|
- 0
|
119
|
-
hash:
|
133
|
+
hash: 4362279711177264786
|
120
134
|
requirements: []
|
121
135
|
rubyforge_project:
|
122
|
-
rubygems_version: 1.8.
|
136
|
+
rubygems_version: 1.8.25
|
123
137
|
signing_key:
|
124
138
|
specification_version: 3
|
125
139
|
summary: CSS stylesheet splitter for Rails
|
@@ -135,11 +149,29 @@ test_files:
|
|
135
149
|
- test/dummy/app/views/layouts/application.html.erb
|
136
150
|
- test/dummy/app/controllers/tests_controller.rb
|
137
151
|
- test/dummy/app/controllers/application_controller.rb
|
138
|
-
- test/dummy/app/
|
139
|
-
- test/dummy/app/helpers/tests_helper.rb
|
152
|
+
- test/dummy/app/assets/stylesheets/test_stylesheet_with_media_queries_split2.css.split2
|
140
153
|
- test/dummy/app/assets/stylesheets/too_big_stylesheet_split2.css.split2
|
154
|
+
- test/dummy/app/assets/stylesheets/test_stylesheet_with_media_queries.css
|
141
155
|
- test/dummy/app/assets/stylesheets/application.css
|
142
156
|
- test/dummy/app/assets/stylesheets/too_big_stylesheet.css.scss
|
157
|
+
- test/dummy/tmp/cache/sass/e89c44a583723860dc69c83f73f8c6d9513c313c/too_big_stylesheet.css.scssc
|
158
|
+
- test/dummy/tmp/cache/assets/D44/640/sprockets%2F12084178a650e7df6c4b71baf988c5ea
|
159
|
+
- test/dummy/tmp/cache/assets/E32/A40/sprockets%2F5964a02e2bf7bc79ebffb414bfb6df5c
|
160
|
+
- test/dummy/tmp/cache/assets/D23/170/sprockets%2F45f2cb247bdf9a5c97748e3f0897822a
|
161
|
+
- test/dummy/tmp/cache/assets/D45/010/sprockets%2Fe5609c41f6effb12ebf399a01337457e
|
162
|
+
- test/dummy/tmp/cache/assets/C66/170/sprockets%2F0830b343f8968ec4aa8370f868668248
|
163
|
+
- test/dummy/tmp/cache/assets/D35/500/sprockets%2F45b349f1b8c8016ce45eac3aa5e63531
|
164
|
+
- test/dummy/tmp/cache/assets/DA2/FD0/sprockets%2F72ac2ef2ba1cb3e39d55428df6356ef8
|
165
|
+
- test/dummy/tmp/cache/assets/CBA/E20/sprockets%2F50f31c73e7bf4e4615292f7f386c9026
|
166
|
+
- test/dummy/tmp/cache/assets/D43/540/sprockets%2Fa296fc4bd718f6277c297b142bc3b58a
|
167
|
+
- test/dummy/tmp/cache/assets/DB7/EE0/sprockets%2F32bab925c6af34ffea7c025aa09d511a
|
168
|
+
- test/dummy/tmp/cache/assets/CFC/990/sprockets%2F87aeb2d2c5f12012d6d908b3a3466b12
|
169
|
+
- test/dummy/tmp/cache/assets/D9E/DF0/sprockets%2F5c364cce43467cca51d7fee41b38b8d2
|
170
|
+
- test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6
|
171
|
+
- test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705
|
172
|
+
- test/dummy/tmp/cache/assets/D10/120/sprockets%2Fc42700fc2e334676ada28a968f262ed6
|
173
|
+
- test/dummy/tmp/cache/assets/CFB/3F0/sprockets%2Fc5701cb90862b1e1da20a31c93180ff8
|
174
|
+
- test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953
|
143
175
|
- test/dummy/script/rails
|
144
176
|
- test/dummy/Rakefile
|
145
177
|
- test/dummy/public/404.html
|
@@ -1,15 +0,0 @@
|
|
1
|
-
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
-
// listed below.
|
3
|
-
//
|
4
|
-
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
-
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
-
//
|
7
|
-
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
-
// the compiled file.
|
9
|
-
//
|
10
|
-
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
-
// GO AFTER THE REQUIRES BELOW.
|
12
|
-
//
|
13
|
-
//= require jquery
|
14
|
-
//= require jquery_ujs
|
15
|
-
//= require_tree .
|
@@ -1,13 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
-
* listed below.
|
4
|
-
*
|
5
|
-
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
-
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
-
*
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
-
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
-
*
|
11
|
-
*= require_self
|
12
|
-
*= require_tree .
|
13
|
-
*/
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>CssSplitter</title>
|
5
|
-
<%= stylesheet_link_tag "css_splitter/application", :media => "all" %>
|
6
|
-
<%= javascript_include_tag "css_splitter/application" %>
|
7
|
-
<%= csrf_meta_tags %>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
|
11
|
-
<%= yield %>
|
12
|
-
|
13
|
-
</body>
|
14
|
-
</html>
|