module Sprockets::Engines
def engine_mime_types
Internal: Returns a `Hash` of engine extensions to mime types.
def engine_mime_types config[:engine_mime_types] end
def engines
# => {".coffee" => CoffeeScriptProcessor, ".sass" => SassProcessor, ...}
environment.engines
that extension will be returned.
If an `ext` argument is supplied, the `Engine` associated with
Returns a `Hash` of `Engine`s registered on the `Environment`.
def engines config[:engines] end
def register_engine(ext, klass, options = {})
environment.register_engine '.coffee', CoffeeScriptProcessor
has an engine registered, it will be overridden.
Registers a new Engine `klass` for `ext`. If the `ext` already
def register_engine(ext, klass, options = {}) unless options[:silence_deprecation] msg = <<-MSG ckets method `register_engine` is deprecated. se register a mime type using `register_mime_type` then `register_compressor` or `register_transformer`. s://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors MSG Deprecation.new([caller.first]).warn(msg) end ext = Sprockets::Utils.normalize_extension(ext) self.computed_config = {} if klass.respond_to?(:call) processor = klass self.config = hash_reassoc(config, :engines) do |engines| engines.merge(ext => klass) end if options[:mime_type] self.config = hash_reassoc(config, :engine_mime_types) do |mime_types| mime_types.merge(ext.to_s => options[:mime_type]) end end else processor = LegacyTiltProcessor.new(klass) self.config = hash_reassoc(config, :engines) do |engines| engines.merge(ext => processor) end if klass.respond_to?(:default_mime_type) && klass.default_mime_type self.config = hash_reassoc(config, :engine_mime_types) do |mime_types| mime_types.merge(ext.to_s => klass.default_mime_type) end end end end