module Sprockets::Exporting
def export_concurrent
def export_concurrent config[:export_concurrent] end
def export_concurrent=(export_concurrent)
environment.export_concurrent = false
Defaults to true.
Public: Enable or disable the concurrently exporting files
def export_concurrent=(export_concurrent) self.config = config.merge(export_concurrent: export_concurrent).freeze end
def exporters
def exporters config[:exporters] end
def register_exporter(mime_types, klass = nil)
This ensures that `Sprockets::Exporters::File` will always execute before
register_exporter '*/*', Sprockets::Exporters::ZlibExporter
specify this via the `depend_on` keyword.
If your exporter depends on one or more other exporters you can
Public: Registers a new Exporter `klass` for `mime_type`.
def register_exporter(mime_types, klass = nil) mime_types = Array(mime_types) mime_types.each do |mime_type| self.config = hash_reassoc(config, :exporters, mime_type) do |_exporters| _exporters << klass end end end
def unregister_exporter(mime_types, exporter = nil)
environment.unregister_exporter Sprockets::Exporters::ZlibExporter
Can be called without a mime type
environment.unregister_exporter '*/*', Sprockets::Exporters::ZlibExporter
Public: Remove Exporting processor `klass` for `mime_type`.
def unregister_exporter(mime_types, exporter = nil) unless mime_types.is_a? Array if mime_types.is_a? String mime_types = [mime_types] else # called with no mime type exporter = mime_types mime_types = nil end end self.config = hash_reassoc(config, :exporters) do |_exporters| _exporters.each do |mime_type, exporters_array| next if mime_types && !mime_types.include?(mime_type) if exporters_array.include? exporter _exporters[mime_type] = exporters_array.dup.delete exporter end end end end