class Importmap::Map
def draw(path = nil, &block)
def draw(path = nil, &block) if path && File.exist?(path) begin instance_eval(File.read(path), path.to_s) rescue StandardError => e Rails.logger.error "Unable to parse import map from #{path}: #{e.message}" raise InvalidFile, "Unable to parse import map from #{path}: #{e.message}" end elsif block_given? instance_eval(&block) end self end