Sha256: d3bafa31c013fa879d1649f208ba80de145778928b4975e42f201a7241bcdfed

Contents?: true

Size: 756 Bytes

Versions: 10

Compression:

Stored size: 756 Bytes

Contents

require "yui/compressor"

module Middleman
  module Minified
    module Javascript
      include ::Haml::Filters::Base
      def render_with_options(text, options)
        compressor = ::YUI::JavaScriptCompressor.new(:munge => true)
        data = compressor.compress(text)
        <<END
<script type=#{options[:attr_wrapper]}text/javascript#{options[:attr_wrapper]}>#{data.chomp}</script>
END
      end
    end
  
    module StaticJavascript
      def render_path(path)
        if template_exists?(path, :js)
          compressor = YUI::JavaScriptCompressor.new(:munge => true)
          compressor.compress(super)
        else
          super
        end
      end
    end
  end
  
  class Base
    include Middleman::Minified::StaticJavascript
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
middleman-0.9.17 lib/middleman/features/minify_javascript.rb
middleman-0.9.16 lib/middleman/features/minify_javascript.rb
middleman-0.9.15 lib/middleman/features/minify_javascript.rb
middleman-0.9.14 lib/middleman/features/minify_javascript.rb
middleman-0.9.13 lib/middleman/features/minify_javascript.rb
middleman-0.9.12 lib/middleman/features/minify_javascript.rb
middleman-0.9.11 lib/middleman/features/minify_javascript.rb
middleman-0.9.10 lib/middleman/features/minify_javascript.rb
middleman-0.9.9 lib/middleman/features/minify_javascript.rb
middleman-0.9.8 lib/middleman/features/minify_javascript.rb