Module: Card::Set::Abstract::Css::CssFormat
- Extended by:
- Card::Set::AbstractFormat
- Defined in:
- platypus/tmp/set/gem-defaults/mod022-style/abstract/01_css.rb
Instance Method Summary collapse
-
#comment_with_source(css) ⇒ Object
-
#compile(input, _style = :compressed) ⇒ Object
FIXME: method is repeatedly called with “nested”, but there is no handling for it.
-
#compress(input) ⇒ Object
-
#compress? ⇒ Boolean
-
#css_compression_error(error) ⇒ Object
-
#view: compiled ⇒ Object
-
#view: compressed ⇒ Object
-
#view: import ⇒ Object
Instance Method Details
#comment_with_source(css) ⇒ Object
67 68 69 |
# File 'platypus/tmp/set/gem-defaults/mod022-style/abstract/01_css.rb', line 67 def comment_with_source css "// #{card.name}\n#{css}" end |
#compile(input, _style = :compressed) ⇒ Object
FIXME: method is repeatedly called with “nested”, but there is no handling for it
76 77 78 79 80 |
# File 'platypus/tmp/set/gem-defaults/mod022-style/abstract/01_css.rb', line 76 def compile input, _style=:compressed SassC::Engine.new(input, style: :compressed).render rescue StandardError => e raise Card::Error, css_compression_error(e) end |
#compress(input) ⇒ Object
71 72 73 |
# File 'platypus/tmp/set/gem-defaults/mod022-style/abstract/01_css.rb', line 71 def compress input compress? ? compile(input) : compile(input, :nested) end |
#compress? ⇒ Boolean
94 95 96 |
# File 'platypus/tmp/set/gem-defaults/mod022-style/abstract/01_css.rb', line 94 def compress? Cardio.config.compress_assets end |
#css_compression_error(error) ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 |
# File 'platypus/tmp/set/gem-defaults/mod022-style/abstract/01_css.rb', line 82 def css_compression_error error # scss is compiled in a view # If there is a scss syntax error we get the rescued view here # and the error that the rescued view is no valid css # To get the original error we have to refer to Card::Error.current if Card::Error.current Card::Error.current. else "Sass::SyntaxError (#{card.name}): #{error.}" end end |
#view: compiled ⇒ Object
59 60 61 |
# File 'platypus/tmp/set/gem-defaults/mod022-style/abstract/01_css.rb', line 59 view :compiled do compile(_render_core, :nested) end |
#view: compressed ⇒ Object
63 64 65 |
# File 'platypus/tmp/set/gem-defaults/mod022-style/abstract/01_css.rb', line 63 view :compressed do compress(_render_core) end |
#view: import ⇒ Object
55 56 57 |
# File 'platypus/tmp/set/gem-defaults/mod022-style/abstract/01_css.rb', line 55 view :import do %{\n@import url("#{_render_url}");\n} end |