Module: Jekyll::Compressor
- Included in:
- Page, Post, StaticFile
- Defined in:
- lib/jekyll-press.rb
Instance Method Summary collapse
- #output_css(path, content) ⇒ Object
- #output_file(dest, content) ⇒ Object
- #output_html(path, content) ⇒ Object
- #output_js(path, content) ⇒ Object
Instance Method Details
#output_css(path, content) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/jekyll-press.rb', line 29 def output_css(path, content) self.output_file(path, CssPress.press(content)) rescue Racc::ParseError => e warn "parse error occurred while processing: #{path}" warn "details: #{e..strip}" warn "copying initial file" self.output_file(path, content) end |
#output_file(dest, content) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/jekyll-press.rb', line 9 def output_file(dest, content) FileUtils.mkdir_p(File.dirname(dest)) File.open(dest, 'w') do |f| f.write(content) end end |
#output_html(path, content) ⇒ Object
16 17 18 |
# File 'lib/jekyll-press.rb', line 16 def output_html(path, content) self.output_file(path, HtmlPress.press(content)) end |
#output_js(path, content) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/jekyll-press.rb', line 20 def output_js(path, content) self.output_file(path, Uglifier.new.compile(content)) rescue Uglifier::Error => e warn "parse error occurred while processing: #{path}" warn "details: #{e..strip}" warn "copying initial file" self.output_file(path, content) end |