require "action_view"

module HamlCoffeeAssets
  module ActionView
    # Custom resolver to prevent Haml Coffee templates from being rendered by
    # Rails for non-HTML formats, since a template name without a MIME type
    # in it would normally be a fallback for all formats.
    #
    class Resolver < ::ActionView::FileSystemResolver
      def find_templates(name, prefix, partial, details)
        if details[:formats].include?(:html)
          super
        else
          []
        end
      end
    end
  end
end

require "action_view"

module HamlCoffeeAssets
  module ActionView
    # Custom resolver to prevent Haml Coffee templates from being rendered by
    # Rails for non-HTML formats, since a template name without a MIME type
    # in it would normally be a fallback for all formats.
    #
    class Resolver < ::ActionView::FileSystemResolver
      def find_templates(name, prefix, partial, details)
        if details[:formats].include?(:html)
          clear_cache if ::Rails.env == "development"
          super
        else
          []
        end
      end
    end
  end
end

Clear the template cache in development
Clear the template cache in development

Rails template caching is currently too aggressive for haml_coffee_assets.
In development wipe the cache when resolving template requests for html
content types.
