Sha256: 6f1cb42cfc9b7eabf231c93c60899fbf55fcceb689fe725e775d15b745b06f28

Contents?: true

Size: 538 Bytes

Versions: 3

Compression:

Stored size: 538 Bytes

Contents

module Sinatra
  module Mars
    module Js
      # register app
      def self.registered(app)
        # stream images
        app.get %r{(.js)$} do
          content_type 'text/javascript'
          if File.file?(options.views + request.path_info.sub(/\.js$/,'.coffee'))
            coffee_file = options.views + request.path_info.sub(/\.js$/,'.coffee')
            brew(coffee_file)
          else
            open_file(options.views + request.path_info)
          end
        end
      end
    end       
  end
  register Mars::Js
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mars-0.2.0 lib/mars/js.rb
mars-0.1.2 lib/mars/js.rb
mars-0.1.0 lib/mars/js.rb