Skip to content

Instantly share code, notes, and snippets.

@jillmd501
Last active November 11, 2015 20:19
Show Gist options
  • Save jillmd501/e7ce996ea40c332bd077 to your computer and use it in GitHub Desktop.
Save jillmd501/e7ce996ea40c332bd077 to your computer and use it in GitHub Desktop.
1. What does it mean to concatenate files? Find an image of an example concatenated file. Why would we want to concatenate files?
It means one can reduce the number of requests that a browser makes to render a web page, which leads to faster load time. Compiling a bunch of files into one location.
Ex. file1.txt file2.txt ---> file3.txt
What does it mean to precompile files? What does this have to do with coffeescript and sass files?
Precompiling pulls all JS and CSS files and brings them together and makes them smaller. By default .coffee and .scss files will not be precompiled on their own and Rails uses CoffeeScript for JavaScript and SCSS for CSS. A "translator"
What does it mean to minify files? Find an image of an example minified file. Why would we want to minify files?
The process of removing all unnecessary characters without changing it's functionality. We would want to minify files to make it more efficient and to take up less storage.
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 local host displayed all dependencies for JavaScript to function in full. The application.js file is a concatenation of all the dependencies.
What is a manifest (in terms of the asset pipeline)? Where can you find two manifests in Catch 'em All?
A manifest is a checklist of the dependencies that you need in the app. In catch 'em all, we have //= require jquery and //= require_tree.
In regular HTML files, we bring in css files with <link rel="stylesheet" href="">. How is this done in a Rails project?
In Rails, to call on css files, in application.html.erb it requires the style_sheet_link tage and a javascript_link tag.
Where do you see this line in Catch 'em All?
application.html.erb
How is a digest/fingerprint used on the assets for caching purposes?
Fingerprinting is a technique that makes the name of a file dependent on the contents of the file. When the file contents change, the filename is also changed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment