Skip to content

Commit

Permalink
Merge pull request #15 from michaelbaudino/feature/fix-htmlcompressor…
Browse files Browse the repository at this point in the history
…-contentlength

Fix htmlcompressor Content-Length computation
  • Loading branch information
tdreyno committed Jul 7, 2013
2 parents 2af5417 + e576a58 commit 9ddb993
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/middleman-minify-html/extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ module MinifyHtml
class << self
def registered(app, options={})
app.set :html_compressor, false

app.after_configuration do
unless respond_to?(:html_compressor) && html_compressor
require File.join(File.dirname(__FILE__), 'vendor/htmlcompressor-0.0.6/lib/htmlcompressor')
set :html_compressor, ::HtmlCompressor::Compressor.new(options)
end

# Setup Rack to watch for inline JS
use ::HtmlCompressor::Rack, options
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def call env
end

content = @compressor.compress(content)
headers['Content-Length'] = content.length.to_s if headers['Content-Length']
headers['Content-Length'] = content.bytesize.to_s if headers['Content-Length']

[status, headers, [content]]
else
Expand Down

0 comments on commit 9ddb993

Please sign in to comment.