- What does it mean to concatenate files? Find an image of an example concatenated file. Why would we want to concatenate files?
To concatenate something is to mash it together. link to picture This would be important for performance - allowing the asset pipeline to be more streamlined, loading faster
- What does it mean to precompile files? What does this have to do with coffeescript and sass files?
Precompiling alters (arranges?) your assests so they can be served as quickly and directly as possible. This involves coffeescript and sass as they are two things that can be precompiled (?).
- What does it mean to minify files? Find an image of an example minified file. Why would we want to minify files?
Minifying removes all unecessary characters (whitespaces, newlines, comments, block delimiters (sometimes)), WITHOUT changing functionality. This reduces the amount of data that has to be transferred, again increasing performance. Also, it is not compression, as it does not need to be decompressed before it can be the interpreter can read it. link to example
- 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?
What you view in the browser is a file that has been compiled from lots of other assets (per the documentation in the text editor).
- What is a manifest (in terms of the asset pipeline)? Where can you find two manifests in Catch ‘em All?
Manifests contain directives (instructions) for sprockets to load, concatenate, and process the files. app/assets/javascripts/application.js
and app/assets/stylesheets/application.css.scss
have manifests.
- 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?
In the app/views/layouts/application.html.erb
, and there it uses helpers to pull it in from the assets, it seems.
- How is a digest/fingerprint used on the assets for caching purposes?
Finger print makes a file name unique based on its contents, cacheing allows copy of the asset to be stored locally, improving performance. Then, when the content (and there by the filename) changes, it can only then pull down the new version.
- Done? Take a look at RailsGuides: The Asset Pipeline.