- What does it mean to concatenate files? Find an image of an example concatenated file. Why would we want to concatenate files?
- File concatenation is combining files. This saves us time when loading assets because the browser needs to make fewer external calls.
- What does it mean to precompile files? What does this have to do with coffeescript and sass files?
- Precompiling converts higher level languages into their base language. SASS -> CSS. Coffeescript -> Javascript.
- What does it mean to minify files? Find an image of an example minified file. Why would we want to minify files?
- Minifying a file reduces it to the smallest size possible while retaining its functionality. For example, variable names are compressed to single letter values, and white space is stripped out.
- 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?
- I think that the file in the browser has all the other JS assets concatenated into it.
- What is a manifest (in terms of the asset pipeline)? Where can you find two manifests in Catch ‘em All?
- application.js and application.css.scss. Both tell Rails what assets to be loaded into the pipeline.
- 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?
- This is done via the manifest file's directives. In Catch 'em All, those are the commented lines that say something like *=jquery
- How is a digest/fingerprint used on the assets for caching purposes?
- A fingerprint is a filename that is unique to that file's contents. If the file contents change, the file name changes. This allows servers to use cached resources with confidence. There's no reason to re-request a resource if it already has the resource in its cache.