Toni Rib, Dan Winters, Joseph Perry
- What does it mean to concatenate files? Find an image of an example concatenated file. Why would we want to concatenate files?
- When you concatenate files, you combine multiple files into one large file so you only have to make one request.
- What does it mean to precompile files? What does this have to do with coffeescript and sass files?
- To put the files into a format that your browser can read prior to the browser requesting it. Coffeescript compiles to javascript and sass compiles to css.
- What does it mean to minify files? Find an image of an example minified file. Why would we want to minify files?
- Remove all whitespaces and shorten any code that can be shortened. This makes the files much smaller so they load more quickly, but they also aren't human readable so you can't work in them that way.
- Start up the server for Catch 'em All (rails s) and navigate to http://localhost:3000/assets/application.js. Then open up the code for application.js in your text editor. Why are these not the same?
- The application.js file is requiring jquery and other files in the tree, so what you see in the server is actually all of those javascript files. The lines with the
//=are not actually commented out.
- What is a manifest (in terms of the asset pipeline)? Where can you find two manifests in Catch 'em All?
- Manifest:
//= require jquery
//= require jquery_ujs
//= require_tree .
- Allows the browser to make one request instead of many.
- Key phrase for Sprockets
- You can make as many manifest files as you need
- Similar to grunt or gulp but for rails
- In regular HTML files, we bring in css files with . How is this done in a Rails project? Where do you see this line in Catch 'em All?
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %><%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>- they are in the application.html.erb file in the layouts view folder, basically requires the manifest files.
- How is a digest/fingerprint used on the assets for caching purposes?
- The browser only needs to rerequest the assets if the current hash doesn't match the new hash, i.e. if there have been changes to the file on the server.