Complete the code to include the main CSS file in a Rails view.
<%= stylesheet_link_tag '[1]', media: 'all' %>
The stylesheet_link_tag helper includes CSS files. By default, Rails uses application.css as the main stylesheet.
Complete the code to include a JavaScript file in a Rails view.
<%= javascript_include_tag '[1]' %>
The javascript_include_tag helper includes JavaScript files. Rails uses application.js as the default JavaScript pack.
Fix the error in the asset pipeline configuration to precompile additional assets.
Rails.application.config.assets.precompile += ['[1]']
To add extra files to the asset pipeline precompile list, specify their exact names like 'custom.js'. 'application.css' is already precompiled by default.
Fill both blanks to create a helper method that returns the path to an asset and its digest fingerprint.
def asset_path(name) Rails.application.assets.[1].digest_path(name) || [2] end
The manifest holds the fingerprinted asset paths. The asset_manifest is used to fallback if the asset is not found.
Fill all three blanks to configure Rails to serve static assets with cache control headers.
Rails.application.config.public_file_server.[1] = true Rails.application.config.public_file_server.headers = { 'Cache-Control' => '[2]', 'Expires' => [3] }
Setting enabled to true allows serving static files. The Cache-Control header sets caching duration, and Expires sets the expiration date.