middleman / middleman-minify-html

A HTML whitespace minifier for Middleman
https://middlemanapp.com/
MIT License
77 stars 13 forks source link

Fails on HTML files with other extension, e.g. *.PHP #33

Closed ghost closed 9 years ago

ghost commented 9 years ago

Versions:

gem 'middleman', '~>3.4.0'
gem 'middleman-minify-html', '~> 3.4.1'

In config.rb the file extension is changed to PHP, like so: set :index_file, 'index.php'

All templates and content files named with the proper PHP extension, e.g. a content file like index.php.md

Expected outcome: A final file called index.php containing minified HTML.

Actual outcome: A final file index.php with un-minified HTML.

tdreyno commented 9 years ago

I'm sure sure you can safely compress HTML with embedded PHP.

Looks like you could set the mime-type of php files to html to get the compressor to run, but you'll want to make sure it doesn't break the code.

::Rack::Mime::MIME_TYPES['.php'] = 'text/html'