Web Development

There are quite a lot of files whenever you generate scaffolds with Rails applications.

$ rails g scaffold Banner
      invoke  active_record
      create    db/migrate/20130901035956_create_banners.rb
      create    app/models/banner.rb
      invoke    test_unit
      create      test/unit/banner_test.rb
      create      test/fixtures/banners.yml
      invoke  resource_route
       route    resources :banners
      invoke  scaffold_controller
      create    app/controllers/banners_controller.rb
      invoke    haml
      create      app/views/banners
      create      app/views/banners/index.html.haml
      create      app/views/banners/edit.html.haml
      create      app/views/banners/show.html.haml
      create      app/views/banners/new.html.haml
      create      app/views/banners/_form.html.haml
      invoke    test_unit
      create      test/functional/banners_controller_test.rb
      invoke    helper
      create      app/helpers/banners_helper.rb
      invoke      test_unit
      create        test/unit/helpers/banners_helper_test.rb
      invoke  assets
      invoke    coffee
      create      app/assets/javascripts/banners.js.coffee
      invoke    scss
      create      app/assets/stylesheets/banners.css.scss
      invoke  scss
      create   app/assets/stylesheets/scaffolds.css.scss

There are some generated files like scaffolds.css.scss, banners.js.coffee and banners.css.scss. Most of the time, we don’t need these.

Here’s a way to skip the css and javascript files.

$ rails g scaffold Banner --skip-stylesheets --skip-javascripts
      invoke  active_record
      create    db/migrate/20130901040251_create_banners.rb
      create    app/models/banner.rb
      invoke    test_unit
      create      test/unit/banner_test.rb
      create      test/fixtures/banners.yml
      invoke  resource_route
       route    resources :banners
      invoke  scaffold_controller
      create    app/controllers/banners_controller.rb
      invoke    haml
      create      app/views/banners
      create      app/views/banners/index.html.haml
      create      app/views/banners/edit.html.haml
      create      app/views/banners/show.html.haml
      create      app/views/banners/new.html.haml
      create      app/views/banners/_form.html.haml
      invoke    test_unit
      create      test/functional/banners_controller_test.rb
      invoke    helper
      create      app/helpers/banners_helper.rb
      invoke      test_unit
      create        test/unit/helpers/banners_helper_test.rb
      invoke  assets
      invoke    coffee
      invoke    scss
      invoke  scss

Options, --skip-stylesheets and --skip-javascripts skips stylesheets and javascripts, respectively.