Masatoshi Nishiguchi

Rails asset bundles and page specific js

Single asset bundle vs multiple asset bundles

Page Specific Javascript

doctype html
html
  /...
  = content_tag :body, class: "#{action_name}_view", id: controller_name, data: { action: action_name, controller: controller_name } do
    /...
doctype html
html
  /...
  - body_class = user_signed_in? ? "body--logged-in" : "body"
  - body_data = { action: action_name.dasherize, controller: controller_path.parameterize.dasherize }
  = content_tag :body, class: body_class, data: body_data do
    /...