Sha256: 95c45fbeb03a02c4679f20a05a8a0b45bfadd634e7d350736b62c7dd83c1fde9
Contents?: true
Size: 625 Bytes
Versions: 1
Compression:
Stored size: 625 Bytes
Contents
require 'tilt' require_relative './sprockets_index_webpack' require_relative './task' module WebpackRails class Processor < Tilt::Template def prepare end def evaluate(context, locals) return data unless context.pathname.to_s.include?('.bundle') # wait til webpack is done before loading result = WebpackRails::Task.run_webpack result[:modules].map{|m| context.depend_on m} bundle_contents = context.pathname.open.read # rewrite $asset_paths in strings bundle_contents.gsub(/['"]\$asset_path\/([^'"]+?)['"]/) {|s| "'#{context.asset_path($1)}'" } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
webpack_rails-0.1.0 | lib/webpack_rails/processor.rb |