Class: Muwu::RenderHtmlPartial::DocumentCss

Inherits:
Object
  • Object
show all
Includes:
Muwu
Defined in:
lib/muwu/render_html_partial/render_document_css.rb

Constant Summary

Constants included from Muwu

GEM_HOME_LIB, GEM_HOME_LIB_MUWU, VERSION

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Muwu

debug, read

Instance Attribute Details

#destinationObject

Returns the value of attribute destination.



12
13
14
# File 'lib/muwu/render_html_partial/render_document_css.rb', line 12

def destination
  @destination
end

Instance Method Details

#renderObject



18
19
20
21
22
23
24
25
26
# File 'lib/muwu/render_html_partial/render_document_css.rb', line 18

def render
  @destination.output_stream do
    if @project.exceptions_include?(ProjectException::CssManifestFileNotFound)
      write_css_missing_comment
    else
      write_css
    end
  end
end

#write_cssObject



38
39
40
# File 'lib/muwu/render_html_partial/render_document_css.rb', line 38

def write_css
  @destination.write_inline SassC::Engine.new(File.read(@project.css_manifest_filename), syntax: :scss, load_paths: ['config/css']).render
end

#write_css_missing_commentObject



29
30
31
32
33
34
35
# File 'lib/muwu/render_html_partial/render_document_css.rb', line 29

def write_css_missing_comment
  @destination.write_line "/*"
  @destination.write_line "#{ProjectException::CssManifestFileNotFound}"
  @destination.write_line "  - CSS manifest file could not be found."
  @destination.write_line "  - Expecting `#{project.css_manifest_filename}`"
  @destination.write_line "*/"
end