Class: Roadie::Inliner Private
- Inherits:
-
Object
- Object
- Roadie::Inliner
- Defined in:
- lib/roadie/inliner.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
The Inliner inlines stylesheets to the elements of the DOM.
Inlining means that StyleBlocks and a DOM tree are combined:
“‘css a { color: red; } # StyleBlock “` “`html <a href=“/”></a> # DOM “`
becomes
“‘html <a href=“/” style=“color:red”></a> “`
Defined Under Namespace
Classes: StyleMap
Instance Method Summary collapse
-
#initialize(stylesheets, dom) ⇒ Inliner
constructor
private
A new instance of Inliner.
-
#inline(options = {}) ⇒ nil
private
Start the inlining, mutating the DOM tree.
Constructor Details
#initialize(stylesheets, dom) ⇒ Inliner
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Inliner.
29 30 31 32 |
# File 'lib/roadie/inliner.rb', line 29 def initialize(stylesheets, dom) @stylesheets = stylesheets @dom = dom end |
Instance Method Details
#inline(options = {}) ⇒ nil
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Start the inlining, mutating the DOM tree.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/roadie/inliner.rb', line 40 def inline( = {}) keep_uninlinable_css = .fetch(:keep_uninlinable_css, true) keep_uninlinable_in = .fetch(:keep_uninlinable_in, :head) merge_media_queries = .fetch(:merge_media_queries, true) style_map, extra_blocks = consume_stylesheets apply_style_map(style_map) if keep_uninlinable_css add_uninlinable_styles(keep_uninlinable_in, extra_blocks, merge_media_queries) end nil end |