lib/webpack_rails/processor.rb in webpack_rails-1.2.1 vs lib/webpack_rails/processor.rb in webpack_rails-1.2.2
- old
+ new
@@ -21,19 +21,23 @@
def rewrite_asset_paths(contents, context)
contents.gsub(/['"]\$asset_path\/([^'"]+?)['"]/) {|s| "'#{context.asset_path($1)}'" }
end
+ def dependable_asset(filepath)
+ File.file?(filepath) # ignore non-filepath entries
+ end
+
def evaluate(context, locals)
return data unless context.pathname.to_s.include?('.bundle')
file_contents = nil
if self.class.config[:watch]
result = WebpackRails::Task.run_webpack(self.class.config)
# add webpack bundle dependencies as sprockets dependencies for this file
result[:modules].map do |m|
- context.depend_on(m) if m.start_with?('/') # ignore non-filepath entries
+ context.depend_on(m) if dependable_asset(m)
end
file_contents = context.pathname.open.read # reload file contents after build
else
file_contents = data