Every time I create a controller, rails generate a controler_name.js and a controller_name.css file on app/assets folder. I already disable the config.assets.enabled param on application.rb but this not solve my problem. How can I disable the generator for those files when creating controller ?
Thanks
rake assets:precompile. We use rake assets:precompile to precompile our assets before pushing code to production. This command precompiles assets and places them under the public/assets directory in our Rails application.
The require_tree directive tells Sprockets to recursively include all JavaScript files in the specified directory into the output. These paths must be specified relative to the manifest file.
Resource GeneratorsA migration file that will create a new database table for the attributes passed to it in the generator. A model file that inherits from ApplicationRecord (as of Rails 5; see Note above) A controller file that inherits from ApplicationController. A view directory, but no view template files.
You can pass --skip-assets
to your command to prevent these files from being created:
rails g controller foo --skip-assets
If you want something more permanent, you can turn it off altogether. Add this to config/application.rb
(from How do I turn off automatic stylesheet/javascript generation on Rails 3.1?)
config.generators.stylesheets = false
config.generators.javascripts = false
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With