lib/webpack_rails/engine.rb in webpack_rails-0.2.0 vs lib/webpack_rails/engine.rb in webpack_rails-0.3.0
- old
+ new
@@ -1,15 +1,21 @@
require_relative './processor'
module WebpackRails
class Engine < ::Rails::Engine
- engine_name "webpack"
+ engine_name 'webpack'
- initializer :setup_webpack_rails, :after => "sprockets.environment", :group => :all do |app|
+ initializer :setup_webpack_rails, after: 'sprockets.environment', group: :all do |app|
# where [name].bundle.js files should be
app.assets.append_path Rails.root.join('tmp/webpack/bundles')
- # process
+
+ # process
app.assets.register_preprocessor('application/javascript', WebpackRails::Processor)
+
+ # stop sprockets from ruining inline sourcemaps in dev
+ if Rails.env.development?
+ app.assets.unregister_postprocessor 'application/javascript', Sprockets::SafetyColons
+ end
end
rake_tasks do
load 'webpack_rails/webpack.rake'
end