The main features of the asset pipeline are:
Concatenation: All JS files are concatenated into a single
.js file and all CSS files are concatenated into a single
.css file. This allows the browser to make fewer requests so our pages load more quickly.
Sass (Syntactically Awesome Stylesheets) is a CSS language. It allows us to enhance our CSS writing by offering features that are not available in straight CSS such as variables, inheritance, mixins, nesting and arguments. We write our code in Sass and then the Sass is converted into a standard CSS file so our application can use it.
We should store images in the app/assets/images directory. We can then use the
image_tag helper to call them like this:
<%= image_tag "rails.png" %>
For more information on the asset pipeline, visit the RailsGuides documentation especially these sections:
Lesson 21 of 34
Last updated August 7, 2022