Sha256: 6460453560d657eea300b7d71a18953b124075d5fca3bd6e8e86ddbc289beb6f
Contents?: true
Size: 768 Bytes
Versions: 2
Compression:
Stored size: 768 Bytes
Contents
module RailsAdmin class ESModulePreprocessor def self.instance @instance ||= new end def self.call(input) instance.call(input) end def initialize; end def call(input) data = input[:data] # only process files under rails_admin/src if input[:filename].start_with? RailsAdmin::Engine.root.join('src').to_s data.gsub!(/^(import .+)$/) { "// #{Regexp.last_match(1)}" } data.gsub!(/^(export +default +{)$/) do case File.basename(input[:filename]) when 'i18n.js' "/* #{Regexp.last_match(1)} */ window.I18n = {" else raise "Unable to preprocess file: #{input[:filename]}" end end end {data: data} end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rails_admin-3.0.0.beta2 | lib/rails_admin/support/esmodule_preprocessor.rb |
rails_admin-3.0.0.beta | lib/rails_admin/support/esmodule_preprocessor.rb |