- What does it mean to concatenate files? Find an image of an example concatenated file. Why would we want to concatenate files?
Take contents from all files and puts them together in one file
- What does it mean to precompile files? What does this have to do with coffeescript and sass files?
Takes abstractions of languages (ie SASS and Coffeescript) and preprocess them down into native languages (CSS & Javascript)
- What does it mean to minify files? Find an image of an example minified file. Why would we want to minify files?
Eliminates whitespace and make a file as small as possible
- Start up the server for Catch 'em All (
rails s
) and navigate to http://localhost:3000/assets/application.js. Then open up the code forapplication.js
in your text editor. Why are these not the same?
On localhost you see all the code, in your assets you just see require statements for the outside libraries Once you are on localhost, all the code has been precompiled so now you can see these libraries
- What is a manifest (in terms of the asset pipeline)? Where can you find two manifests in Catch 'em All?
file that will be compiled into application with all the files that listed/referenced in it you can find them in assets and the files are application.css and application.js
- In regular HTML files, we bring in css files with
<link rel="stylesheet" href="application.css">
. How is this done in a Rails project? Where do you see this line in Catch 'em All?
In app/views/layouts/application.html.erb we see this line: <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
- How is a digest/fingerprint used on the assets for caching purposes?
Fingerprint is unique based on the content of the file and will change if anything is different in the file
- Done? Take a look at RailsGuides: The Asset Pipeline.