Sha256: d3195e21cf80156946662a6ce3c8c838932ab1c757d15b2a611e41379e22bac5

Contents?: true

Size: 599 Bytes

Versions: 2

Compression:

Stored size: 599 Bytes

Contents

module Mascot
  module Extensions
    # Removes the file extension from the file so that /hi/there/fun.html can be
    # resolved via /hi/there/fun.
    class RailsRequestPaths
      def process_resources(node)
        node.flatten.each do |r|
          asset = r.asset
          request_path = r.request_path
          r.node.remove
          node.add path: self.class.format_path(request_path), asset: asset
        end
      end

      def self.format_path(request_path)
        File.join(File.dirname(File.join("/", request_path)), File.basename(request_path, ".*"))
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mascot-rails-0.1.16 lib/mascot/extensions/rails_request_paths.rb
mascot-rails-0.1.15 lib/mascot/extensions/rails_request_paths.rb