diff --git a/config/application.rb b/config/application.rb index 597b21a71..34e59a189 100644 --- a/config/application.rb +++ b/config/application.rb @@ -14,7 +14,7 @@ class Application < Rails::Application # Please, add to the `ignore` list any other `lib` subdirectories that do # not contain `.rb` files, or that should not be reloaded or eager loaded. # Common ones are `templates`, `generators`, or `middleware`, for example. - config.autoload_lib(ignore: %w[assets tasks generators]) + config.autoload_lib(ignore: %w[assets tasks]) # Configuration for the application, engines, and railties goes here. # diff --git a/lib/generators/rails/webpacker_assets/webpacker_assets_generator.rb b/lib/generators/rails/webpacker_assets/webpacker_assets_generator.rb index 456d71fc9..cd7b2e05e 100644 --- a/lib/generators/rails/webpacker_assets/webpacker_assets_generator.rb +++ b/lib/generators/rails/webpacker_assets/webpacker_assets_generator.rb @@ -1,12 +1,18 @@ -module Rails - class WebpackerAssetsGenerator < Rails::Generators::NamedBase - def create_assets_file - create_file "app/javascript/packs/#{file_name}.js", <<-FILE - your content - FILE - create_file "app/assets/stylesheets/#{file_name}.scss", <<-FILE - your content - FILE +require 'rails/generators' + +module Generators + module Rails + module WebpackerAssets + class WebpackerAssetsGenerator < ::Rails::Generators::NamedBase + def create_assets_file + create_file "app/javascript/packs/#{file_name}.js", <<-FILE + // your content + FILE + create_file "app/assets/stylesheets/#{file_name}.scss", <<-FILE + // your content + FILE + end + end end end end