Sha256: 2300a79ca64a420cfa5211083cee5d87f12db7de7a55c67996923db333b9bc72

Contents?: true

Size: 601 Bytes

Versions: 1

Compression:

Stored size: 601 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.resources.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

1 entries across 1 versions & 1 rubygems

Version Path
mascot-rails-0.1.14 lib/mascot/extensions/rails_request_paths.rb