assets_booster 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module AssetsBooster
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
@@ -1,7 +1,19 @@
1
1
  module AssetsBooster
2
2
  module ViewHelper
3
- def style_tag(css, options = {})
4
- content_tag(:style, css, options.merge(:type => Mime::CSS))
3
+ def style_tag(content_or_options_with_block = nil, html_options = {}, &block)
4
+ content =
5
+ if block_given?
6
+ html_options = content_or_options_with_block if content_or_options_with_block.is_a?(Hash)
7
+ capture(&block)
8
+ else
9
+ content_or_options_with_block
10
+ end
11
+
12
+ content_tag(:style, style_cdata_section(content), html_options.merge(:type => Mime::CSS))
13
+ end
14
+
15
+ def style_cdata_section(content)
16
+ "\n/*#{cdata_section("*/\n#{content}\n/*")}*/\n".html_safe
5
17
  end
6
18
 
7
19
  def assets_booster_tag(type, *names)
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: assets_booster
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.9
5
+ version: 0.0.10
6
6
  platform: ruby
7
7
  authors:
8
8
  - Corin Langosch