css_splitter 0.2.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +8 -8
  2. data/README.md +28 -54
  3. data/app/helpers/css_splitter/application_helper.rb +12 -10
  4. data/lib/css_splitter.rb +1 -1
  5. data/lib/css_splitter/engine.rb +1 -1
  6. data/lib/css_splitter/splitter.rb +34 -1
  7. data/lib/css_splitter/sprockets_engine.rb +7 -3
  8. data/lib/css_splitter/version.rb +1 -1
  9. data/test/css_splitter_test.rb +34 -0
  10. data/test/dummy/app/assets/stylesheets/combined.css.scss +4 -0
  11. data/test/dummy/app/assets/stylesheets/combined_split2.css +3 -0
  12. data/test/dummy/app/assets/stylesheets/erb_stylesheet.css.scss.erb +7 -0
  13. data/test/dummy/app/assets/stylesheets/erb_stylesheet_split2.css +3 -0
  14. data/test/dummy/app/assets/stylesheets/erb_stylesheet_split3.css +3 -0
  15. data/test/dummy/app/assets/stylesheets/green_max.css.scss.erb +3 -0
  16. data/test/dummy/app/assets/stylesheets/red_100.css.scss.erb +3 -0
  17. data/test/dummy/app/assets/stylesheets/test_stylesheet_with_media_queries_split2.css +3 -0
  18. data/test/dummy/app/assets/stylesheets/too_big_stylesheet_split2.css +3 -0
  19. data/test/dummy/config/application.rb +0 -1
  20. data/test/dummy/config/environments/development.rb +2 -0
  21. data/test/dummy/config/environments/production.rb +2 -0
  22. data/test/dummy/config/environments/test.rb +2 -0
  23. data/test/dummy/log/production.log +0 -0
  24. data/test/dummy/log/test.log +588 -0
  25. data/test/dummy/tmp/cache/assets/{D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 → development/sprockets/13fe41fee1fe35b49d145bcc06610705} +0 -0
  26. data/test/dummy/tmp/cache/assets/{CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 → development/sprockets/357970feca3ac29060c1e3861e2c0953} +0 -0
  27. data/test/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  28. data/test/dummy/tmp/cache/assets/production/sass/b18a7747d943dd020c4bfdf3754c527fa8524b5b/combined.css.scssc +0 -0
  29. data/test/dummy/tmp/cache/assets/production/sass/b18a7747d943dd020c4bfdf3754c527fa8524b5b/green_max.css.scss.erbc +0 -0
  30. data/test/dummy/tmp/cache/assets/production/sass/b18a7747d943dd020c4bfdf3754c527fa8524b5b/red_100.css.scss.erbc +0 -0
  31. data/test/dummy/tmp/cache/assets/production/sass/b18a7747d943dd020c4bfdf3754c527fa8524b5b/too_big_stylesheet.css.scssc +0 -0
  32. data/test/dummy/tmp/cache/assets/production/sprockets/0830b343f8968ec4aa8370f868668248 +0 -0
  33. data/test/dummy/tmp/cache/assets/production/sprockets/0b721c131ad2142b39a1947ba7186369 +0 -0
  34. data/test/dummy/tmp/cache/assets/production/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  35. data/test/dummy/tmp/cache/assets/production/sprockets/22a5a1651eda39579a0ac9ed19894730 +0 -0
  36. data/test/dummy/tmp/cache/assets/production/sprockets/32bab925c6af34ffea7c025aa09d511a +0 -0
  37. data/test/dummy/tmp/cache/assets/production/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  38. data/test/dummy/tmp/cache/assets/production/sprockets/39fd278352b772e098112f7f25f70cad +0 -0
  39. data/test/dummy/tmp/cache/assets/production/sprockets/48279a0d3bfb1252abd9c35c097c5994 +0 -0
  40. data/test/dummy/tmp/cache/assets/production/sprockets/5964a02e2bf7bc79ebffb414bfb6df5c +0 -0
  41. data/test/dummy/tmp/cache/assets/production/sprockets/5c364cce43467cca51d7fee41b38b8d2 +0 -0
  42. data/test/dummy/tmp/cache/assets/production/sprockets/6403010c1ca0cb17615027724c2101f4 +0 -0
  43. data/test/dummy/tmp/cache/assets/production/sprockets/7808b3f4a805cc4644882be056088fd5 +0 -0
  44. data/test/dummy/tmp/cache/assets/production/sprockets/7f49d72527d04af68b22828bfd93a487 +0 -0
  45. data/test/dummy/tmp/cache/assets/production/sprockets/bcf8e6c3b8d95af1ea2fbb57c3429158 +0 -0
  46. data/test/dummy/tmp/cache/assets/production/sprockets/c5701cb90862b1e1da20a31c93180ff8 +0 -0
  47. data/test/dummy/tmp/cache/assets/production/sprockets/c9750dd5995631096c42e0ee2b08bdc2 +0 -0
  48. data/test/dummy/tmp/cache/assets/production/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  49. data/test/dummy/tmp/cache/assets/production/sprockets/de6e0c2b56f11be6215058985f78fc22 +0 -0
  50. data/test/dummy/tmp/cache/assets/production/sprockets/e5609c41f6effb12ebf399a01337457e +0 -0
  51. data/test/dummy/tmp/cache/assets/production/sprockets/e731ba9557bf61573ac4f38a4648a45e +0 -0
  52. data/test/dummy/tmp/cache/assets/production/sprockets/e91e9a9bbc721b2440323fdf67823613 +0 -0
  53. data/test/unit/helpers/css_splitter/application_helper_test.rb +7 -2
  54. data/test/unit/splitter_test.rb +131 -1
  55. metadata +93 -31
  56. data/test/dummy/app/assets/stylesheets/test_stylesheet_with_media_queries_split2.css.split2 +0 -1
  57. data/test/dummy/app/assets/stylesheets/too_big_stylesheet_split2.css.split2 +0 -1
  58. data/test/dummy/tmp/cache/assets/CFB/3F0/sprockets%2Fc5701cb90862b1e1da20a31c93180ff8 +0 -0
  59. data/test/dummy/tmp/cache/assets/CFC/990/sprockets%2F87aeb2d2c5f12012d6d908b3a3466b12 +0 -0
  60. data/test/dummy/tmp/cache/assets/D22/590/sprockets%2F24c1f9d49cd8543f25bf82d365da6939 +0 -0
  61. data/test/dummy/tmp/cache/assets/D23/170/sprockets%2F45f2cb247bdf9a5c97748e3f0897822a +0 -0
  62. data/test/dummy/tmp/cache/assets/D35/500/sprockets%2F45b349f1b8c8016ce45eac3aa5e63531 +0 -0
  63. data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  64. data/test/dummy/tmp/cache/assets/D90/C40/sprockets%2F016dcd02588d8f6f1625aace5e41aa1c +0 -0
  65. data/test/dummy/tmp/cache/assets/D9E/DF0/sprockets%2F5c364cce43467cca51d7fee41b38b8d2 +0 -0
  66. data/test/dummy/tmp/cache/assets/DB7/EE0/sprockets%2F32bab925c6af34ffea7c025aa09d511a +0 -0
  67. data/test/dummy/tmp/cache/assets/E86/410/sprockets%2Fcedb11a422be3ba8fef2da27df4f87fb +0 -0
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZWI1MjlmMTE4Nzk4NWI5Yzg1MmIwOTQ4NzQ2OGQ3Y2QyNTc2M2ViNA==
4
+ MDNhMzBiNWQxMzBjYzdiNjM0ZTY4NDRiNzViMDEyZmY0MjBlNDYwZA==
5
5
  data.tar.gz: !binary |-
6
- ODNlOTcxZTcxNDhlMmUwYjJhNmNkZTExODM2NGQzMTRlMDRkOTU4Zg==
6
+ OGRmNTdjMTM3MzE3Yzk4MjM4MzhmZGZmZjNmNTQ1M2M3MmRmMGUyZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NzZjMWY1ZGU0ZGVmZDk4ZjMxNWI3NmNkODAxN2I5ZjQ4MjE1ZTY3YjUzNzk2
10
- NDQ2MGFjZDc1MDQzNGZhYThkM2U4YWQ1ZjkwNDFmZGE4YjYxYjY1NDlhZGFl
11
- ZDU5YTQ5MzcwOGM5NGJjOWMwOTgwMjI5NWEzZDNlMTYyNGJjM2Q=
9
+ YzM5M2Y4NGRhMTlmMTcyNGZjOWY1NWU4OGE4OTFkMmMxNGI2ZTZiMzE0MjBj
10
+ ZjU3NWRkYjc0NWZlNTE4NGI1OTljMWQwOTkzMjY4OWRkYjZmNjVmZTExMjZh
11
+ YjFmZjA1NDE0MDQ5OTY1MWJjZTZlNzIxMjVhMTdjOTViODEzM2E=
12
12
  data.tar.gz: !binary |-
13
- NmE1YjExMmFmN2Q4ODY3MTJjMGFhYjliMzhjNWVkZWZkYmNlMGE2MDA2ODBj
14
- MDliODUwZGMyYzJiYzQwZWE1OTY0YjBjZDRiZjVmYTRlNzdlOThkZWE3NGM2
15
- MDNiZGE5ZmZlNzVhNTgxNjRhOTNkODFlYjAyOWIyMDM0ZDI0Zjc=
13
+ OGJkZmIzNTY5ODEwZmIzYmY1M2YzMWZhMTZlNGExOGQ5NzkzNzkyMjhkZTkz
14
+ NTAxNjA0YWJkY2EzNjQ4Yjc5NGUxMmY2ZDg4ZDk0ZjUyNDBiZTNlYTg3MGZh
15
+ MDA1ODUwN2Q1YzYyYTcwYmE1ZTQxNTkxZmFmMjhmMDU1MjAyNzA=
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # CssSplitter [![Build Status](https://travis-ci.org/zweilove/css_splitter.png?branch=master)](https://travis-ci.org/zweilove/css_splitter) [![Dependency Status](https://gemnasium.com/zweilove/css_splitter.png)](https://gemnasium.com/zweilove/css_splitter)
1
+ # CssSplitter [![Build Status](https://travis-ci.org/zweilove/css_splitter.png?branch=master)](https://travis-ci.org/zweilove/css_splitter)
2
2
 
3
3
  Gem for splitting up stylesheets that go beyond the IE limit of 4096 selectors, for Rails 3.1+ apps using the Asset Pipeline. You can read this [blogpost](http://railslove.com/blog/2013/03/08/overcoming-ies-4096-selector-limit-using-the-css-splitter-gem) for an explanation of this gem's background story.
4
4
 
@@ -16,22 +16,26 @@ CssSplitter integrates with the Rails 3.1+ Asset Pipeline to generate additional
16
16
 
17
17
  ## Dependencies
18
18
 
19
- * Rails 3.1+
20
- * Asset Pipeline
19
+ * Sprockets 2.0+
20
+ * e.g. Rails 3.1+ with the asset pipeline
21
21
 
22
22
  ## Documentation
23
23
 
24
24
  ### 1. Splitting your stylesheets
25
25
 
26
- The first step is indentifying the stylesheets that have more than 4095 selectors and therefore need to be split for IE.
26
+ The first step is identifying the stylesheets that have more than 4095 selectors and therefore need to be split for IE.
27
27
 
28
- Once you know which stylesheets need to be split, you need to create a second "container file" for those stylesheets with the file extension `.split2`, that will contain the styles beyond the 4095 selector limit.
28
+ Once you know which stylesheets need to be split, you need to create a second "container file" for those stylesheets with the `_split2` suffix appended to the base filename that will contain the styles beyond the 4095 selector limit. The extension of this file should be just `.css` without any additional preprocessor extensions.
29
29
 
30
- For example, if you want to split `too_big_stylesheet.css`, you need to create a new file `too_big_stylesheet_split2.css.split2` in the same directory. The only content of that container, will be an include of the original file, e.g.:
30
+ For example, if you want to split `too_big_stylesheet.css.scss`, you need to create a new file `too_big_stylesheet_split2.css` in the same directory. The only content of that container, will contain a `require` directive to the name of the original asset, e.g.:
31
31
 
32
- # app/assets/stylesheets/too_big_stylesheet_split2.css.split2
32
+ # app/assets/stylesheets/too_big_stylesheet_split2.css
33
33
 
34
- //= include 'too_big_stylesheet.css'
34
+ /*
35
+ *= require 'too_big_stylesheet'
36
+ */
37
+
38
+ If your stylesheet is big enough to need splitting into more than two more files, simply create additional `_split3`, `_split4`, etc. files, the contents of which should be identical to the `_split2` file.
35
39
 
36
40
  You also need to remember to add those new files to the asset pipeline, so they will be compiled. For example:
37
41
 
@@ -43,12 +47,10 @@ You also need to remember to add those new files to the asset pipeline, so they
43
47
 
44
48
  Here is a checklist of requirements for your split stylesheet:
45
49
 
46
- 1. It needs to have different filename than orginal, e.g. `original_stylesheet_split2` or `application_split2`
47
- 2. It needs to have `.split2` as the terminal file extension, e.g. `.css.split2` or `.css.sass.split2`
48
- 3. It needs to include the content of the orginal stylesheet, e.g. through `//= include 'application'`
49
- 4. It needs to be added to list of precompiled assets
50
-
51
-
50
+ 1. It needs to have the `_splitN` suffix appended to the original asset name, e.g. `original_stylesheet_split2` or `application_split2`
51
+ 2. It needs to have `.css` as a file extension.
52
+ 3. It needs to require the orginal stylesheet.
53
+ 4. It needs to be added to list of precompiled assets.
52
54
 
53
55
  ### 2. Including your split stylesheets
54
56
 
@@ -60,57 +62,28 @@ You can just use our `split_stylesheet_link_tag` helper, which would look someth
60
62
  <%= split_stylesheet_link_tag "too_big_stylesheet", :media => "all" %>
61
63
 
62
64
  # output
63
- <link href="/stylesheets/too_big_stylesheet.css" media="screen" rel="stylesheet" type="text/css" />
65
+ <link href="/stylesheets/too_big_stylesheet.css" media="all" rel="stylesheet" type="text/css" />
64
66
  <!--[if lte IE 9]>
65
- <link href="/stylesheets/too_big_stylesheet_split2.css" media="screen" rel="stylesheet" type="text/css" />
67
+ <link href="/stylesheets/too_big_stylesheet_split2.css" media="all" rel="stylesheet" type="text/css" />
66
68
  <![endif]-->
67
69
 
70
+ If your stylesheet is split into more than two files, add the `split_count` option to specify the total number of files.
71
+
72
+ <%= split_stylesheet_link_tag "too_big_stylesheet", :split_count => 3 %>
73
+
68
74
  Or you can just create similar HTML as in the above example yourself. If you want to use the `split_stylesheet_link_tag` helper you need to make sure the gem is loaded in production, so you can't put it in the `:assets` group in your Gemfile.
69
75
 
70
76
  ## How it works
71
77
 
72
- Basically, CssSplitter is registering a new `Sprockets::Engine` for the `.split2` file extension, that will fill those files with all the selectors beyond the 4095th. Unfortunately, those `.split2` files need to be created manually, because we haven't figured out a way for a `Sprockets::Engine` to output multiple files. They need to present before the compile step.
78
+ Basically, CssSplitter is registering a new Sprockets bundle processor that looks for CSS assets named with the `_splitN` suffix and will fill those files with all the selectors beyond the 4095th. Unfortunately, those `_splitN` files need to be created manually, because we haven't figured out a way for a `Sprockets::Engine` to output multiple files. They need to present before the compile step.
73
79
 
74
80
  If you have more questions about how it works, look at the code or contact us.
75
81
 
76
82
  ## Gotchas
77
83
 
78
- #### Having a JS asset with the same name as the the split stylesheet
79
-
80
- If you want to split a style (e.g. `assets/stylesheets/application.*`) and have a JS asset with the same name (`assets/javascripts/application.*`) in your asset load_path (as is the default in Rails), you need to include the stylesheet along with the file extension `// = include 'application.css'` because otherwise it will try to include the JS asset of the same name instead. Sprocket's `= include` directive doesn't seem to differentiate between different types/folders and just takes the first asset it can find for any given name (see #10).
81
-
82
- #### Don't use Sprocket's `= require_tree .` or `= require_self` for stylesheets
83
- It's recommended that you **always use Sass's `@import`** for all your stylesheets in favor of Sprocket's `= require` directives, just as the official `sass-rails` gem says: https://github.com/rails/sass-rails#important-note
84
-
85
- If you have a `.split2` stylesheet in your tree that in turn includes the base stylesheet like shown below, you will end up with a nasty `Sprockets::CircularDependencyError`!
86
-
87
- /* assets/stylesheets/application.css */
88
- /* = require_tree .
89
-
90
- /* assets/stylesheets/application_split2.css.split2 */
91
- /* = include 'application.css' */
92
-
93
- If you have `require_self` in the stylesheet that you're splitting, as shown below, the `.split2` will end up having **both** the original stylesheet and the split contents. You'll end up with an even bigger stylesheet.
94
-
95
- /* assets/stylesheets/application.css */
96
- /* = require_self
97
-
98
- /* assets/stylesheets/application_split2.css.split2 */
99
- /* = include 'application.css' */
100
-
101
-
102
- ## Limitations & Known Issues
103
-
104
- **More than 8190 selectors**
105
-
106
- Currently the gem only supports stylesheets that need to be split into 2 files. It could theoretically create more splits (e.g. if you should have more than 8190 selectors), but in that case you should probably refactor your stylesheets anyway. Contact us, if you have this requirement.
107
-
108
- **@media queries**
109
-
110
- The selector counting algorithm is currently not counting `@media` queries correctly. For each `@media` query it is adding one additional selector to the count (which is actually not a problem in most cases).
111
-
112
- If you have a `@media` query spawning right over the 4096 selector barrier, it will probably get ripped apart into the two splits and ultimately produce broken CSS. You can either try to move the `@media` queries (e.g. before the 4096 selector barrier) or help us fix this issue.
84
+ #### Differences from previous versions
113
85
 
86
+ Note that if you used versions below `0.4.0` of this gem, the naming and contents of the split files have changed. Split files no longer need to have the `.split2` extension and now use the `require` directive rather than the `include` directive. The previous prohibition against using `require_tree .` and `require_self` directives also no longer applies. For more details see the [CHANGELOG.md](CHANGELOG.md#040)
114
87
 
115
88
  ## Credits & License
116
89
 
@@ -118,8 +91,9 @@ This is a joint project by the two German Rails shops [Zweitag](http://zweitag.d
118
91
 
119
92
  The original code was written by [Christian Peters](mailto:christian.peters@zweitag.de) and [Thomas Hollstegge](mailto:thomas.hollstegge@zweitag.de) (see this [Gist](https://gist.github.com/2398394)) and turned into a gem by [Jakob Hilden](mailto:jakobhilden@gmail.com).
120
93
 
121
- This project rocks and uses MIT-LICENSE.
94
+ **Major Contributors**
122
95
 
96
+ * [@Umofomia](https://github.com/Umofomia)
123
97
 
124
- [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/zweilove/css_splitter/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
98
+ This project rocks and uses MIT-LICENSE.
125
99
 
@@ -1,18 +1,20 @@
1
1
  module CssSplitter
2
2
  module ApplicationHelper
3
3
  def split_stylesheet_link_tag(*sources)
4
- original_sources = sources.dup
4
+ options = sources.extract_options!
5
+ split_count = options.delete(:split_count) || 2
5
6
 
6
- options = sources.extract_options!
7
- sources.collect!{ |source| "#{source}_split2" }
8
- sources << options
7
+ sources.map do |source|
8
+ split_sources = (2..split_count).map { |index| "#{source}_split#{index}" }
9
+ split_sources << options
9
10
 
10
- [
11
- stylesheet_link_tag(*original_sources),
12
- "<!--[if lte IE 9]>",
13
- stylesheet_link_tag(*sources),
14
- "<![endif]-->"
15
- ].join("\n").html_safe
11
+ [
12
+ stylesheet_link_tag(source, options),
13
+ "<!--[if lte IE 9]>",
14
+ stylesheet_link_tag(*split_sources),
15
+ "<![endif]-->"
16
+ ]
17
+ end.flatten.join("\n").html_safe
16
18
  end
17
19
  end
18
20
  end
data/lib/css_splitter.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "css_splitter/engine"
1
+ require "css_splitter/engine" if defined?(Rails)
2
2
  require "css_splitter/sprockets_engine"
3
3
  require "css_splitter/splitter"
4
4
 
@@ -3,7 +3,7 @@ module CssSplitter
3
3
  isolate_namespace CssSplitter
4
4
 
5
5
  initializer 'css_splitter.sprockets_engine', after: 'sprockets.environment', group: :all do |app|
6
- app.assets.register_engine '.split2', CssSplitter::SprocketsEngine
6
+ app.assets.register_bundle_processor 'text/css', CssSplitter::SprocketsEngine
7
7
  end
8
8
 
9
9
  initializer 'css_splitter.action_controller' do |app|
@@ -26,23 +26,50 @@ module CssSplitter
26
26
  selectors_count = 0
27
27
  selector_range = max_selectors * (part - 1) + 1 .. max_selectors * part # e.g (4096..8190)
28
28
 
29
+ current_media = nil
30
+ selectors_in_media = 0
31
+ first_hit = true
29
32
  rules.each do |rule|
33
+ media_part = extract_media(rule)
34
+ if media_part
35
+ current_media = media_part
36
+ selectors_in_media = 0
37
+ end
38
+
30
39
  rule_selectors_count = count_selectors_of_rule rule
31
40
  selectors_count += rule_selectors_count
32
41
 
42
+ if rule =~ /\A\s*}\z$/
43
+ current_media = nil
44
+ # skip the line if the close bracket is the first rule for the new file
45
+ next if first_hit
46
+ end
47
+
33
48
  if selector_range.cover? selectors_count # add rule to current output if within selector_range
49
+ if media_part
50
+ output << media_part
51
+ elsif first_hit && current_media
52
+ output << current_media
53
+ end
54
+ selectors_in_media += rule_selectors_count if current_media.present?
34
55
  output << rule
56
+ first_hit = false
35
57
  elsif selectors_count > selector_range.end # stop writing to output
36
58
  break
37
59
  end
38
60
  end
39
61
 
62
+ if current_media.present? and selectors_in_media > 0
63
+ output << '}'
64
+ end
65
+
40
66
  output
41
67
  end
42
68
 
43
69
  # count selectors of one individual CSS rule
44
70
  def self.count_selectors_of_rule(rule)
45
- strip_comments(rule).partition(/\{/).first.scan(/,/).count.to_i + 1
71
+ parts = strip_comments(rule).partition(/\{/)
72
+ parts.second.empty? ? 0 : parts.first.scan(/,/).count.to_i + 1
46
73
  end
47
74
 
48
75
 
@@ -61,6 +88,12 @@ module CssSplitter
61
88
 
62
89
  private
63
90
 
91
+ def self.extract_media(rule)
92
+ if rule.sub!(/^\s*(@media[^{]*{)([^{}]*{[^}]*})$/) { $2 }
93
+ $1
94
+ end
95
+ end
96
+
64
97
  # extracts potential charset declaration from the first rule
65
98
  def self.extract_charset(rule)
66
99
  if rule.include?('charset')
@@ -11,9 +11,13 @@ module CssSplitter
11
11
  end
12
12
 
13
13
  def evaluate(scope, locals, &block)
14
- split = scope.pathname.extname =~ /(\d+)$/ && $1 || 0 # determine which is the current split (e.g. split2, split3)
15
- CssSplitter::Splitter.split_string data, split.to_i
14
+ # Evaluate the split if the asset is named with a trailing _split2, _split3, etc.
15
+ if scope.logical_path =~ /_split(\d+)$/
16
+ CssSplitter::Splitter.split_string(data, $1.to_i)
17
+ else
18
+ data
19
+ end
16
20
  end
17
21
  end
18
22
 
19
- end
23
+ end
@@ -1,3 +1,3 @@
1
1
  module CssSplitter
2
- VERSION = "0.2.0"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -1,7 +1,41 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class CssSplitterTest < ActiveSupport::TestCase
4
+
5
+ setup :clear_assets_cache
6
+
4
7
  test "truth" do
5
8
  assert_kind_of Module, CssSplitter
6
9
  end
10
+
11
+ test "asset pipeline stylesheet splitting" do
12
+ part1 = "#test{background-color:red}" * CssSplitter::Splitter::MAX_SELECTORS_DEFAULT
13
+ part2 = "#test{background-color:green}" * CssSplitter::Splitter::MAX_SELECTORS_DEFAULT
14
+ part3 = "#test{background-color:blue}"
15
+
16
+ assert_equal "#{part1}#{part2}#{part3}\n", assets["erb_stylesheet"].to_s
17
+ assert_equal "#{part2}\n", assets["erb_stylesheet_split2"].to_s
18
+ assert_equal "#{part3}\n", assets["erb_stylesheet_split3"].to_s
19
+ end
20
+
21
+ test "asset pipeline stylesheet splitting on stylesheet combined using requires" do
22
+ red = "#test{background-color:red}" * 100
23
+ green = "#test{background-color:green}" * CssSplitter::Splitter::MAX_SELECTORS_DEFAULT
24
+ blue = "#test{background-color:blue}"
25
+
26
+ assert_equal "#{red}#{green}#{blue}\n", assets["combined"].to_s
27
+ assert_equal "#{"#test{background-color:green}" * 100}#{blue}\n", assets["combined_split2"].to_s
28
+ end
29
+
30
+ private
31
+
32
+ def clear_assets_cache
33
+ assets_cache = Rails.root.join("tmp/cache/assets")
34
+ assets_cache.rmtree if assets_cache.exist?
35
+ end
36
+
37
+ def assets
38
+ Rails.application.assets
39
+ end
40
+
7
41
  end
@@ -0,0 +1,4 @@
1
+ //= require 'red_100'
2
+ //= require 'green_max'
3
+
4
+ #test { background-color: blue; }
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require 'combined'
3
+ */
@@ -0,0 +1,7 @@
1
+ <% CssSplitter::Splitter::MAX_SELECTORS_DEFAULT.times do %>
2
+ #test { background-color: red; }
3
+ <% end %>
4
+ <% CssSplitter::Splitter::MAX_SELECTORS_DEFAULT.times do %>
5
+ #test { background-color: green; }
6
+ <% end %>
7
+ #test { background-color: blue; }
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require 'erb_stylesheet.css'
3
+ */
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require 'erb_stylesheet.css'
3
+ */
@@ -0,0 +1,3 @@
1
+ <% CssSplitter::Splitter::MAX_SELECTORS_DEFAULT.times do %>
2
+ #test { background-color: green; }
3
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <% 100.times do %>
2
+ #test { background-color: red; }
3
+ <% end %>
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require 'test_stylesheet_with_media_queries'
3
+ */
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require 'too_big_stylesheet.css'
3
+ */
@@ -3,7 +3,6 @@ require File.expand_path('../boot', __FILE__)
3
3
  # require 'rails/all'
4
4
  require "action_controller/railtie"
5
5
  require "action_mailer/railtie"
6
- require "active_resource/railtie"
7
6
  require "rails/test_unit/railtie"
8
7
  require "sprockets/railtie"
9
8
 
@@ -34,4 +34,6 @@ Dummy::Application.configure do
34
34
 
35
35
  # Expands the lines which load the assets
36
36
  config.assets.debug = true
37
+
38
+ config.eager_load = false
37
39
  end
@@ -64,4 +64,6 @@ Dummy::Application.configure do
64
64
  # Log the query plan for queries taking more than this (works
65
65
  # with SQLite, MySQL, and PostgreSQL)
66
66
  # config.active_record.auto_explain_threshold_in_seconds = 0.5
67
+
68
+ config.eager_load = true
67
69
  end
@@ -34,4 +34,6 @@ Dummy::Application.configure do
34
34
 
35
35
  # Print deprecation notices to the stderr
36
36
  config.active_support.deprecation = :stderr
37
+
38
+ config.eager_load = false
37
39
  end
File without changes
@@ -94,3 +94,591 @@ Connecting to database specified by database.yml
94
94
   (0.0ms) rollback transaction
95
95
   (0.0ms) begin transaction
96
96
   (0.0ms) rollback transaction
97
+ --------------------------------------
98
+ CssSplitterTest: test_#count_selectors
99
+ --------------------------------------
100
+ ----------------------------------------------
101
+ CssSplitterTest: test_#count_selectors_of_rule
102
+ ----------------------------------------------
103
+ ---------------------------------------------------
104
+ CssSplitterTest: test_#extract_charset_with_charset
105
+ ---------------------------------------------------
106
+ ------------------------------------------------------
107
+ CssSplitterTest: test_#extract_charset_with_no_charset
108
+ ------------------------------------------------------
109
+ -----------------------------------------------------
110
+ CssSplitterTest: test_#extract_media_with_media_block
111
+ -----------------------------------------------------
112
+ --------------------------------------------------------
113
+ CssSplitterTest: test_#extract_media_with_no_media_block
114
+ --------------------------------------------------------
115
+ ----------------------------------------------
116
+ CssSplitterTest: test_#split_string_into_rules
117
+ ----------------------------------------------
118
+ ---------------------------------------------------------------------
119
+ CssSplitterTest: test_#split_string_into_rules_for_multiline_comments
120
+ ---------------------------------------------------------------------
121
+ -----------------------------------------------------------------------
122
+ CssSplitterTest: test_#split_string_into_rules_for_single_line_comments
123
+ -----------------------------------------------------------------------
124
+ -----------------------------------------------------------------------------------------
125
+ CssSplitterTest: test_#split_string_into_rules_for_strings_with_protocol_independent_urls
126
+ -----------------------------------------------------------------------------------------
127
+ -----------------------------------------------------------
128
+ CssSplitterTest: test_#split_string_to_get_the_second_split
129
+ -----------------------------------------------------------
130
+ ----------------------------------------------------------------------------------------------------------------------------------------------------------
131
+ CssSplitterTest: test_#split_string_where_the_media_part_would_overlap_the_split,_all_rules_in_media_before_the_split,_closing_would_end_up_in_second_part
132
+ ----------------------------------------------------------------------------------------------------------------------------------------------------------
133
+ --------------------------------------------------------------------------------------------------------------------
134
+ CssSplitterTest: test_#split_string_where_the_media_part_would_overlap_the_split,_no_rules_in_media_before_the_split
135
+ --------------------------------------------------------------------------------------------------------------------
136
+ ----------------------------------------------------------------------------------------------------------------------
137
+ CssSplitterTest: test_#split_string_where_the_media_part_would_overlap_the_split,_with_rules_in_media_before_the_split
138
+ ----------------------------------------------------------------------------------------------------------------------
139
+ -----------------------------------------------------------------
140
+ CssSplitterTest: test_#strip_comments:_strip_multiline_CSS_coment
141
+ -----------------------------------------------------------------
142
+ -------------------------------------------------------------------
143
+ CssSplitterTest: test_#strip_comments:_strip_single_line_CSS_coment
144
+ -------------------------------------------------------------------
145
+ ---------------------------
146
+ CssSplitterTest: test_truth
147
+ ---------------------------
148
+ ------------------------------------------------------------------
149
+ CssSplitter::ApplicationHelperTest: test_should_work_w/out_options
150
+ ------------------------------------------------------------------
151
+ ------------------------------------------------------------------------------------------
152
+ CssSplitter::ApplicationHelperTest: test_should_work_with_options_and_multiple_stylesheets
153
+ ------------------------------------------------------------------------------------------
154
+ --------------------------------------
155
+ CssSplitterTest: test_#count_selectors
156
+ --------------------------------------
157
+ ----------------------------------------------
158
+ CssSplitterTest: test_#count_selectors_of_rule
159
+ ----------------------------------------------
160
+ ---------------------------------------------------
161
+ CssSplitterTest: test_#extract_charset_with_charset
162
+ ---------------------------------------------------
163
+ ------------------------------------------------------
164
+ CssSplitterTest: test_#extract_charset_with_no_charset
165
+ ------------------------------------------------------
166
+ -----------------------------------------------------
167
+ CssSplitterTest: test_#extract_media_with_media_block
168
+ -----------------------------------------------------
169
+ --------------------------------------------------------
170
+ CssSplitterTest: test_#extract_media_with_no_media_block
171
+ --------------------------------------------------------
172
+ ----------------------------------------------
173
+ CssSplitterTest: test_#split_string_into_rules
174
+ ----------------------------------------------
175
+ ---------------------------------------------------------------------
176
+ CssSplitterTest: test_#split_string_into_rules_for_multiline_comments
177
+ ---------------------------------------------------------------------
178
+ -----------------------------------------------------------------------
179
+ CssSplitterTest: test_#split_string_into_rules_for_single_line_comments
180
+ -----------------------------------------------------------------------
181
+ -----------------------------------------------------------------------------------------
182
+ CssSplitterTest: test_#split_string_into_rules_for_strings_with_protocol_independent_urls
183
+ -----------------------------------------------------------------------------------------
184
+ -----------------------------------------------------------
185
+ CssSplitterTest: test_#split_string_to_get_the_second_split
186
+ -----------------------------------------------------------
187
+ ----------------------------------------------------------------------------------------------------------------------------------------------------------
188
+ CssSplitterTest: test_#split_string_where_the_media_part_would_overlap_the_split,_all_rules_in_media_before_the_split,_closing_would_end_up_in_second_part
189
+ ----------------------------------------------------------------------------------------------------------------------------------------------------------
190
+ --------------------------------------------------------------------------------------------------------------------
191
+ CssSplitterTest: test_#split_string_where_the_media_part_would_overlap_the_split,_no_rules_in_media_before_the_split
192
+ --------------------------------------------------------------------------------------------------------------------
193
+ ----------------------------------------------------------------------------------------------------------------------
194
+ CssSplitterTest: test_#split_string_where_the_media_part_would_overlap_the_split,_with_rules_in_media_before_the_split
195
+ ----------------------------------------------------------------------------------------------------------------------
196
+ -----------------------------------------------------------------
197
+ CssSplitterTest: test_#strip_comments:_strip_multiline_CSS_coment
198
+ -----------------------------------------------------------------
199
+ -------------------------------------------------------------------
200
+ CssSplitterTest: test_#strip_comments:_strip_single_line_CSS_coment
201
+ -------------------------------------------------------------------
202
+ ---------------------------
203
+ CssSplitterTest: test_truth
204
+ ---------------------------
205
+ ------------------------------------------------------------------
206
+ CssSplitter::ApplicationHelperTest: test_should_work_w/out_options
207
+ ------------------------------------------------------------------
208
+ ------------------------------------------------------------------------------------------
209
+ CssSplitter::ApplicationHelperTest: test_should_work_with_options_and_multiple_stylesheets
210
+ ------------------------------------------------------------------------------------------
211
+ --------------------------------------
212
+ CssSplitterTest: test_#count_selectors
213
+ --------------------------------------
214
+ ----------------------------------------------
215
+ CssSplitterTest: test_#count_selectors_of_rule
216
+ ----------------------------------------------
217
+ ---------------------------------------------------
218
+ CssSplitterTest: test_#extract_charset_with_charset
219
+ ---------------------------------------------------
220
+ ------------------------------------------------------
221
+ CssSplitterTest: test_#extract_charset_with_no_charset
222
+ ------------------------------------------------------
223
+ -----------------------------------------------------
224
+ CssSplitterTest: test_#extract_media_with_media_block
225
+ -----------------------------------------------------
226
+ --------------------------------------------------------
227
+ CssSplitterTest: test_#extract_media_with_no_media_block
228
+ --------------------------------------------------------
229
+ ----------------------------------------------
230
+ CssSplitterTest: test_#split_string_into_rules
231
+ ----------------------------------------------
232
+ ---------------------------------------------------------------------
233
+ CssSplitterTest: test_#split_string_into_rules_for_multiline_comments
234
+ ---------------------------------------------------------------------
235
+ -----------------------------------------------------------------------
236
+ CssSplitterTest: test_#split_string_into_rules_for_single_line_comments
237
+ -----------------------------------------------------------------------
238
+ -----------------------------------------------------------------------------------------
239
+ CssSplitterTest: test_#split_string_into_rules_for_strings_with_protocol_independent_urls
240
+ -----------------------------------------------------------------------------------------
241
+ -----------------------------------------------------------
242
+ CssSplitterTest: test_#split_string_to_get_the_second_split
243
+ -----------------------------------------------------------
244
+ ----------------------------------------------------------------------------------------------------------------------------------------------------------
245
+ CssSplitterTest: test_#split_string_where_the_media_part_would_overlap_the_split,_all_rules_in_media_before_the_split,_closing_would_end_up_in_second_part
246
+ ----------------------------------------------------------------------------------------------------------------------------------------------------------
247
+ --------------------------------------------------------------------------------------------------------------------
248
+ CssSplitterTest: test_#split_string_where_the_media_part_would_overlap_the_split,_no_rules_in_media_before_the_split
249
+ --------------------------------------------------------------------------------------------------------------------
250
+ ----------------------------------------------------------------------------------------------------------------------
251
+ CssSplitterTest: test_#split_string_where_the_media_part_would_overlap_the_split,_with_rules_in_media_before_the_split
252
+ ----------------------------------------------------------------------------------------------------------------------
253
+ -----------------------------------------------------------------
254
+ CssSplitterTest: test_#strip_comments:_strip_multiline_CSS_coment
255
+ -----------------------------------------------------------------
256
+ -------------------------------------------------------------------
257
+ CssSplitterTest: test_#strip_comments:_strip_single_line_CSS_coment
258
+ -------------------------------------------------------------------
259
+ ---------------------------
260
+ CssSplitterTest: test_truth
261
+ ---------------------------
262
+ ------------------------------------------------------------------
263
+ CssSplitter::ApplicationHelperTest: test_should_work_w/out_options
264
+ ------------------------------------------------------------------
265
+ ------------------------------------------------------------------------------------------
266
+ CssSplitter::ApplicationHelperTest: test_should_work_with_options_and_multiple_stylesheets
267
+ ------------------------------------------------------------------------------------------
268
+ --------------------------------------
269
+ CssSplitterTest: test_#count_selectors
270
+ --------------------------------------
271
+ ----------------------------------------------
272
+ CssSplitterTest: test_#count_selectors_of_rule
273
+ ----------------------------------------------
274
+ ---------------------------------------------------
275
+ CssSplitterTest: test_#extract_charset_with_charset
276
+ ---------------------------------------------------
277
+ ------------------------------------------------------
278
+ CssSplitterTest: test_#extract_charset_with_no_charset
279
+ ------------------------------------------------------
280
+ -----------------------------------------------------
281
+ CssSplitterTest: test_#extract_media_with_media_block
282
+ -----------------------------------------------------
283
+ --------------------------------------------------------
284
+ CssSplitterTest: test_#extract_media_with_no_media_block
285
+ --------------------------------------------------------
286
+ ----------------------------------------------
287
+ CssSplitterTest: test_#split_string_into_rules
288
+ ----------------------------------------------
289
+ ---------------------------------------------------------------------
290
+ CssSplitterTest: test_#split_string_into_rules_for_multiline_comments
291
+ ---------------------------------------------------------------------
292
+ -----------------------------------------------------------------------
293
+ CssSplitterTest: test_#split_string_into_rules_for_single_line_comments
294
+ -----------------------------------------------------------------------
295
+ -----------------------------------------------------------------------------------------
296
+ CssSplitterTest: test_#split_string_into_rules_for_strings_with_protocol_independent_urls
297
+ -----------------------------------------------------------------------------------------
298
+ -----------------------------------------------------------
299
+ CssSplitterTest: test_#split_string_to_get_the_second_split
300
+ -----------------------------------------------------------
301
+ ----------------------------------------------------------------------------------------------------------------------------------------------------------
302
+ CssSplitterTest: test_#split_string_where_the_media_part_would_overlap_the_split,_all_rules_in_media_before_the_split,_closing_would_end_up_in_second_part
303
+ ----------------------------------------------------------------------------------------------------------------------------------------------------------
304
+ --------------------------------------------------------------------------------------------------------------------
305
+ CssSplitterTest: test_#split_string_where_the_media_part_would_overlap_the_split,_no_rules_in_media_before_the_split
306
+ --------------------------------------------------------------------------------------------------------------------
307
+ ----------------------------------------------------------------------------------------------------------------------
308
+ CssSplitterTest: test_#split_string_where_the_media_part_would_overlap_the_split,_with_rules_in_media_before_the_split
309
+ ----------------------------------------------------------------------------------------------------------------------
310
+ -----------------------------------------------------------------
311
+ CssSplitterTest: test_#strip_comments:_strip_multiline_CSS_coment
312
+ -----------------------------------------------------------------
313
+ -------------------------------------------------------------------
314
+ CssSplitterTest: test_#strip_comments:_strip_single_line_CSS_coment
315
+ -------------------------------------------------------------------
316
+ ---------------------------
317
+ CssSplitterTest: test_truth
318
+ ---------------------------
319
+ ------------------------------------------------------------------
320
+ CssSplitter::ApplicationHelperTest: test_should_work_w/out_options
321
+ ------------------------------------------------------------------
322
+ ------------------------------------------------------------------------------------------
323
+ CssSplitter::ApplicationHelperTest: test_should_work_with_options_and_multiple_stylesheets
324
+ ------------------------------------------------------------------------------------------
325
+ --------------------------------------
326
+ CssSplitterTest: test_#count_selectors
327
+ --------------------------------------
328
+ ----------------------------------------------
329
+ CssSplitterTest: test_#count_selectors_of_rule
330
+ ----------------------------------------------
331
+ ---------------------------------------------------
332
+ CssSplitterTest: test_#extract_charset_with_charset
333
+ ---------------------------------------------------
334
+ ------------------------------------------------------
335
+ CssSplitterTest: test_#extract_charset_with_no_charset
336
+ ------------------------------------------------------
337
+ -----------------------------------------------------
338
+ CssSplitterTest: test_#extract_media_with_media_block
339
+ -----------------------------------------------------
340
+ --------------------------------------------------------
341
+ CssSplitterTest: test_#extract_media_with_no_media_block
342
+ --------------------------------------------------------
343
+ ----------------------------------------------
344
+ CssSplitterTest: test_#split_string_into_rules
345
+ ----------------------------------------------
346
+ -----------------------------------------------------------------------
347
+ CssSplitterTest: test_#split_string_into_rules_containing_media_queries
348
+ -----------------------------------------------------------------------
349
+ ---------------------------------------------------------------------
350
+ CssSplitterTest: test_#split_string_into_rules_for_multiline_comments
351
+ ---------------------------------------------------------------------
352
+ -----------------------------------------------------------------------
353
+ CssSplitterTest: test_#split_string_into_rules_for_single_line_comments
354
+ -----------------------------------------------------------------------
355
+ -----------------------------------------------------------------------------------------
356
+ CssSplitterTest: test_#split_string_into_rules_for_strings_with_protocol_independent_urls
357
+ -----------------------------------------------------------------------------------------
358
+ -----------------------------------------------------------
359
+ CssSplitterTest: test_#split_string_to_get_the_second_split
360
+ -----------------------------------------------------------
361
+ -------------------------------------------------------------------------------
362
+ CssSplitterTest: test_#split_string_where_the_media_part_comes_before_the_split
363
+ -------------------------------------------------------------------------------
364
+ ----------------------------------------------------------------------------------------------------------------------------------------------------------
365
+ CssSplitterTest: test_#split_string_where_the_media_part_would_overlap_the_split,_all_rules_in_media_before_the_split,_closing_would_end_up_in_second_part
366
+ ----------------------------------------------------------------------------------------------------------------------------------------------------------
367
+ --------------------------------------------------------------------------------------------------------------------
368
+ CssSplitterTest: test_#split_string_where_the_media_part_would_overlap_the_split,_no_rules_in_media_before_the_split
369
+ --------------------------------------------------------------------------------------------------------------------
370
+ ----------------------------------------------------------------------------------------------------------------------
371
+ CssSplitterTest: test_#split_string_where_the_media_part_would_overlap_the_split,_with_rules_in_media_before_the_split
372
+ ----------------------------------------------------------------------------------------------------------------------
373
+ -----------------------------------------------------------------
374
+ CssSplitterTest: test_#strip_comments:_strip_multiline_CSS_coment
375
+ -----------------------------------------------------------------
376
+ -------------------------------------------------------------------
377
+ CssSplitterTest: test_#strip_comments:_strip_single_line_CSS_coment
378
+ -------------------------------------------------------------------
379
+ ---------------------------------------------------------
380
+ CssSplitterTest: test_asset_pipeline_stylesheet_splitting
381
+ ---------------------------------------------------------
382
+ -----------------------------------------------------------------------------------------------
383
+ CssSplitterTest: test_asset_pipeline_stylesheet_splitting_on_stylesheet_combined_using_requires
384
+ -----------------------------------------------------------------------------------------------
385
+ ---------------------------
386
+ CssSplitterTest: test_truth
387
+ ---------------------------
388
+ ------------------------------------------------------------------
389
+ CssSplitter::ApplicationHelperTest: test_should_work_w/out_options
390
+ ------------------------------------------------------------------
391
+ ------------------------------------------------------------------------------------------
392
+ CssSplitter::ApplicationHelperTest: test_should_work_with_options_and_multiple_stylesheets
393
+ ------------------------------------------------------------------------------------------
394
+ ----------------------------------------------------------------------------
395
+ CssSplitter::ApplicationHelperTest: test_should_work_with_split_count_option
396
+ ----------------------------------------------------------------------------
397
+ --------------------------------------
398
+ CssSplitterTest: test_#count_selectors
399
+ --------------------------------------
400
+ ----------------------------------------------
401
+ CssSplitterTest: test_#count_selectors_of_rule
402
+ ----------------------------------------------
403
+ ---------------------------------------------------
404
+ CssSplitterTest: test_#extract_charset_with_charset
405
+ ---------------------------------------------------
406
+ ------------------------------------------------------
407
+ CssSplitterTest: test_#extract_charset_with_no_charset
408
+ ------------------------------------------------------
409
+ -----------------------------------------------------
410
+ CssSplitterTest: test_#extract_media_with_media_block
411
+ -----------------------------------------------------
412
+ --------------------------------------------------------
413
+ CssSplitterTest: test_#extract_media_with_no_media_block
414
+ --------------------------------------------------------
415
+ ----------------------------------------------
416
+ CssSplitterTest: test_#split_string_into_rules
417
+ ----------------------------------------------
418
+ -----------------------------------------------------------------------
419
+ CssSplitterTest: test_#split_string_into_rules_containing_media_queries
420
+ -----------------------------------------------------------------------
421
+ ---------------------------------------------------------------------
422
+ CssSplitterTest: test_#split_string_into_rules_for_multiline_comments
423
+ ---------------------------------------------------------------------
424
+ -----------------------------------------------------------------------
425
+ CssSplitterTest: test_#split_string_into_rules_for_single_line_comments
426
+ -----------------------------------------------------------------------
427
+ -----------------------------------------------------------------------------------------
428
+ CssSplitterTest: test_#split_string_into_rules_for_strings_with_protocol_independent_urls
429
+ -----------------------------------------------------------------------------------------
430
+ -----------------------------------------------------------
431
+ CssSplitterTest: test_#split_string_to_get_the_second_split
432
+ -----------------------------------------------------------
433
+ -------------------------------------------------------------------------------
434
+ CssSplitterTest: test_#split_string_where_the_media_part_comes_before_the_split
435
+ -------------------------------------------------------------------------------
436
+ ----------------------------------------------------------------------------------------------------------------------------------------------------------
437
+ CssSplitterTest: test_#split_string_where_the_media_part_would_overlap_the_split,_all_rules_in_media_before_the_split,_closing_would_end_up_in_second_part
438
+ ----------------------------------------------------------------------------------------------------------------------------------------------------------
439
+ --------------------------------------------------------------------------------------------------------------------
440
+ CssSplitterTest: test_#split_string_where_the_media_part_would_overlap_the_split,_no_rules_in_media_before_the_split
441
+ --------------------------------------------------------------------------------------------------------------------
442
+ ----------------------------------------------------------------------------------------------------------------------
443
+ CssSplitterTest: test_#split_string_where_the_media_part_would_overlap_the_split,_with_rules_in_media_before_the_split
444
+ ----------------------------------------------------------------------------------------------------------------------
445
+ -----------------------------------------------------------------
446
+ CssSplitterTest: test_#strip_comments:_strip_multiline_CSS_coment
447
+ -----------------------------------------------------------------
448
+ -------------------------------------------------------------------
449
+ CssSplitterTest: test_#strip_comments:_strip_single_line_CSS_coment
450
+ -------------------------------------------------------------------
451
+ ---------------------------------------------------------
452
+ CssSplitterTest: test_asset_pipeline_stylesheet_splitting
453
+ ---------------------------------------------------------
454
+ -----------------------------------------------------------------------------------------------
455
+ CssSplitterTest: test_asset_pipeline_stylesheet_splitting_on_stylesheet_combined_using_requires
456
+ -----------------------------------------------------------------------------------------------
457
+ ---------------------------
458
+ CssSplitterTest: test_truth
459
+ ---------------------------
460
+ ------------------------------------------------------------------
461
+ CssSplitter::ApplicationHelperTest: test_should_work_w/out_options
462
+ ------------------------------------------------------------------
463
+ ------------------------------------------------------------------------------------------
464
+ CssSplitter::ApplicationHelperTest: test_should_work_with_options_and_multiple_stylesheets
465
+ ------------------------------------------------------------------------------------------
466
+ ----------------------------------------------------------------------------
467
+ CssSplitter::ApplicationHelperTest: test_should_work_with_split_count_option
468
+ ----------------------------------------------------------------------------
469
+ --------------------------------------
470
+ CssSplitterTest: test_#count_selectors
471
+ --------------------------------------
472
+ ----------------------------------------------
473
+ CssSplitterTest: test_#count_selectors_of_rule
474
+ ----------------------------------------------
475
+ ---------------------------------------------------
476
+ CssSplitterTest: test_#extract_charset_with_charset
477
+ ---------------------------------------------------
478
+ ------------------------------------------------------
479
+ CssSplitterTest: test_#extract_charset_with_no_charset
480
+ ------------------------------------------------------
481
+ -----------------------------------------------------
482
+ CssSplitterTest: test_#extract_media_with_media_block
483
+ -----------------------------------------------------
484
+ --------------------------------------------------------
485
+ CssSplitterTest: test_#extract_media_with_no_media_block
486
+ --------------------------------------------------------
487
+ ----------------------------------------------
488
+ CssSplitterTest: test_#split_string_into_rules
489
+ ----------------------------------------------
490
+ -----------------------------------------------------------------------
491
+ CssSplitterTest: test_#split_string_into_rules_containing_media_queries
492
+ -----------------------------------------------------------------------
493
+ ---------------------------------------------------------------------
494
+ CssSplitterTest: test_#split_string_into_rules_for_multiline_comments
495
+ ---------------------------------------------------------------------
496
+ -----------------------------------------------------------------------
497
+ CssSplitterTest: test_#split_string_into_rules_for_single_line_comments
498
+ -----------------------------------------------------------------------
499
+ -----------------------------------------------------------------------------------------
500
+ CssSplitterTest: test_#split_string_into_rules_for_strings_with_protocol_independent_urls
501
+ -----------------------------------------------------------------------------------------
502
+ -----------------------------------------------------------
503
+ CssSplitterTest: test_#split_string_to_get_the_second_split
504
+ -----------------------------------------------------------
505
+ -------------------------------------------------------------------------------
506
+ CssSplitterTest: test_#split_string_where_the_media_part_comes_before_the_split
507
+ -------------------------------------------------------------------------------
508
+ ----------------------------------------------------------------------------------------------------------------------------------------------------------
509
+ CssSplitterTest: test_#split_string_where_the_media_part_would_overlap_the_split,_all_rules_in_media_before_the_split,_closing_would_end_up_in_second_part
510
+ ----------------------------------------------------------------------------------------------------------------------------------------------------------
511
+ --------------------------------------------------------------------------------------------------------------------
512
+ CssSplitterTest: test_#split_string_where_the_media_part_would_overlap_the_split,_no_rules_in_media_before_the_split
513
+ --------------------------------------------------------------------------------------------------------------------
514
+ ----------------------------------------------------------------------------------------------------------------------
515
+ CssSplitterTest: test_#split_string_where_the_media_part_would_overlap_the_split,_with_rules_in_media_before_the_split
516
+ ----------------------------------------------------------------------------------------------------------------------
517
+ -----------------------------------------------------------------
518
+ CssSplitterTest: test_#strip_comments:_strip_multiline_CSS_coment
519
+ -----------------------------------------------------------------
520
+ -------------------------------------------------------------------
521
+ CssSplitterTest: test_#strip_comments:_strip_single_line_CSS_coment
522
+ -------------------------------------------------------------------
523
+ ---------------------------------------------------------
524
+ CssSplitterTest: test_asset_pipeline_stylesheet_splitting
525
+ ---------------------------------------------------------
526
+ -----------------------------------------------------------------------------------------------
527
+ CssSplitterTest: test_asset_pipeline_stylesheet_splitting_on_stylesheet_combined_using_requires
528
+ -----------------------------------------------------------------------------------------------
529
+ ---------------------------
530
+ CssSplitterTest: test_truth
531
+ ---------------------------
532
+ ------------------------------------------------------------------
533
+ CssSplitter::ApplicationHelperTest: test_should_work_w/out_options
534
+ ------------------------------------------------------------------
535
+ ------------------------------------------------------------------------------------------
536
+ CssSplitter::ApplicationHelperTest: test_should_work_with_options_and_multiple_stylesheets
537
+ ------------------------------------------------------------------------------------------
538
+ ----------------------------------------------------------------------------
539
+ CssSplitter::ApplicationHelperTest: test_should_work_with_split_count_option
540
+ ----------------------------------------------------------------------------
541
+ --------------------------------------
542
+ CssSplitterTest: test_#count_selectors
543
+ --------------------------------------
544
+ ----------------------------------------------
545
+ CssSplitterTest: test_#count_selectors_of_rule
546
+ ----------------------------------------------
547
+ ---------------------------------------------------
548
+ CssSplitterTest: test_#extract_charset_with_charset
549
+ ---------------------------------------------------
550
+ ------------------------------------------------------
551
+ CssSplitterTest: test_#extract_charset_with_no_charset
552
+ ------------------------------------------------------
553
+ -----------------------------------------------------
554
+ CssSplitterTest: test_#extract_media_with_media_block
555
+ -----------------------------------------------------
556
+ --------------------------------------------------------
557
+ CssSplitterTest: test_#extract_media_with_no_media_block
558
+ --------------------------------------------------------
559
+ ----------------------------------------------
560
+ CssSplitterTest: test_#split_string_into_rules
561
+ ----------------------------------------------
562
+ -----------------------------------------------------------------------
563
+ CssSplitterTest: test_#split_string_into_rules_containing_media_queries
564
+ -----------------------------------------------------------------------
565
+ ---------------------------------------------------------------------
566
+ CssSplitterTest: test_#split_string_into_rules_for_multiline_comments
567
+ ---------------------------------------------------------------------
568
+ -----------------------------------------------------------------------
569
+ CssSplitterTest: test_#split_string_into_rules_for_single_line_comments
570
+ -----------------------------------------------------------------------
571
+ -----------------------------------------------------------------------------------------
572
+ CssSplitterTest: test_#split_string_into_rules_for_strings_with_protocol_independent_urls
573
+ -----------------------------------------------------------------------------------------
574
+ -----------------------------------------------------------
575
+ CssSplitterTest: test_#split_string_to_get_the_second_split
576
+ -----------------------------------------------------------
577
+ -------------------------------------------------------------------------------
578
+ CssSplitterTest: test_#split_string_where_the_media_part_comes_before_the_split
579
+ -------------------------------------------------------------------------------
580
+ ----------------------------------------------------------------------------------------------------------------------------------------------------------
581
+ CssSplitterTest: test_#split_string_where_the_media_part_would_overlap_the_split,_all_rules_in_media_before_the_split,_closing_would_end_up_in_second_part
582
+ ----------------------------------------------------------------------------------------------------------------------------------------------------------
583
+ --------------------------------------------------------------------------------------------------------------------
584
+ CssSplitterTest: test_#split_string_where_the_media_part_would_overlap_the_split,_no_rules_in_media_before_the_split
585
+ --------------------------------------------------------------------------------------------------------------------
586
+ ----------------------------------------------------------------------------------------------------------------------
587
+ CssSplitterTest: test_#split_string_where_the_media_part_would_overlap_the_split,_with_rules_in_media_before_the_split
588
+ ----------------------------------------------------------------------------------------------------------------------
589
+ -----------------------------------------------------------------
590
+ CssSplitterTest: test_#strip_comments:_strip_multiline_CSS_coment
591
+ -----------------------------------------------------------------
592
+ -------------------------------------------------------------------
593
+ CssSplitterTest: test_#strip_comments:_strip_single_line_CSS_coment
594
+ -------------------------------------------------------------------
595
+ ---------------------------------------------------------
596
+ CssSplitterTest: test_asset_pipeline_stylesheet_splitting
597
+ ---------------------------------------------------------
598
+ -----------------------------------------------------------------------------------------------
599
+ CssSplitterTest: test_asset_pipeline_stylesheet_splitting_on_stylesheet_combined_using_requires
600
+ -----------------------------------------------------------------------------------------------
601
+ ---------------------------
602
+ CssSplitterTest: test_truth
603
+ ---------------------------
604
+ ------------------------------------------------------------------
605
+ CssSplitter::ApplicationHelperTest: test_should_work_w/out_options
606
+ ------------------------------------------------------------------
607
+ ------------------------------------------------------------------------------------------
608
+ CssSplitter::ApplicationHelperTest: test_should_work_with_options_and_multiple_stylesheets
609
+ ------------------------------------------------------------------------------------------
610
+ ----------------------------------------------------------------------------
611
+ CssSplitter::ApplicationHelperTest: test_should_work_with_split_count_option
612
+ ----------------------------------------------------------------------------
613
+ --------------------------------------
614
+ CssSplitterTest: test_#count_selectors
615
+ --------------------------------------
616
+ ----------------------------------------------
617
+ CssSplitterTest: test_#count_selectors_of_rule
618
+ ----------------------------------------------
619
+ ---------------------------------------------------
620
+ CssSplitterTest: test_#extract_charset_with_charset
621
+ ---------------------------------------------------
622
+ ------------------------------------------------------
623
+ CssSplitterTest: test_#extract_charset_with_no_charset
624
+ ------------------------------------------------------
625
+ -----------------------------------------------------
626
+ CssSplitterTest: test_#extract_media_with_media_block
627
+ -----------------------------------------------------
628
+ --------------------------------------------------------
629
+ CssSplitterTest: test_#extract_media_with_no_media_block
630
+ --------------------------------------------------------
631
+ ----------------------------------------------
632
+ CssSplitterTest: test_#split_string_into_rules
633
+ ----------------------------------------------
634
+ -----------------------------------------------------------------------
635
+ CssSplitterTest: test_#split_string_into_rules_containing_media_queries
636
+ -----------------------------------------------------------------------
637
+ ---------------------------------------------------------------------
638
+ CssSplitterTest: test_#split_string_into_rules_for_multiline_comments
639
+ ---------------------------------------------------------------------
640
+ -----------------------------------------------------------------------
641
+ CssSplitterTest: test_#split_string_into_rules_for_single_line_comments
642
+ -----------------------------------------------------------------------
643
+ -----------------------------------------------------------------------------------------
644
+ CssSplitterTest: test_#split_string_into_rules_for_strings_with_protocol_independent_urls
645
+ -----------------------------------------------------------------------------------------
646
+ -----------------------------------------------------------
647
+ CssSplitterTest: test_#split_string_to_get_the_second_split
648
+ -----------------------------------------------------------
649
+ -------------------------------------------------------------------------------
650
+ CssSplitterTest: test_#split_string_where_the_media_part_comes_before_the_split
651
+ -------------------------------------------------------------------------------
652
+ ----------------------------------------------------------------------------------------------------------------------------------------------------------
653
+ CssSplitterTest: test_#split_string_where_the_media_part_would_overlap_the_split,_all_rules_in_media_before_the_split,_closing_would_end_up_in_second_part
654
+ ----------------------------------------------------------------------------------------------------------------------------------------------------------
655
+ --------------------------------------------------------------------------------------------------------------------
656
+ CssSplitterTest: test_#split_string_where_the_media_part_would_overlap_the_split,_no_rules_in_media_before_the_split
657
+ --------------------------------------------------------------------------------------------------------------------
658
+ ----------------------------------------------------------------------------------------------------------------------
659
+ CssSplitterTest: test_#split_string_where_the_media_part_would_overlap_the_split,_with_rules_in_media_before_the_split
660
+ ----------------------------------------------------------------------------------------------------------------------
661
+ -----------------------------------------------------------------
662
+ CssSplitterTest: test_#strip_comments:_strip_multiline_CSS_coment
663
+ -----------------------------------------------------------------
664
+ -------------------------------------------------------------------
665
+ CssSplitterTest: test_#strip_comments:_strip_single_line_CSS_coment
666
+ -------------------------------------------------------------------
667
+ ---------------------------------------------------------
668
+ CssSplitterTest: test_asset_pipeline_stylesheet_splitting
669
+ ---------------------------------------------------------
670
+ -----------------------------------------------------------------------------------------------
671
+ CssSplitterTest: test_asset_pipeline_stylesheet_splitting_on_stylesheet_combined_using_requires
672
+ -----------------------------------------------------------------------------------------------
673
+ ---------------------------
674
+ CssSplitterTest: test_truth
675
+ ---------------------------
676
+ ------------------------------------------------------------------
677
+ CssSplitter::ApplicationHelperTest: test_should_work_w/out_options
678
+ ------------------------------------------------------------------
679
+ ------------------------------------------------------------------------------------------
680
+ CssSplitter::ApplicationHelperTest: test_should_work_with_options_and_multiple_stylesheets
681
+ ------------------------------------------------------------------------------------------
682
+ ----------------------------------------------------------------------------
683
+ CssSplitter::ApplicationHelperTest: test_should_work_with_split_count_option
684
+ ----------------------------------------------------------------------------