Last active
April 20, 2016 19:59
-
-
Save seeker105/c2f1ec9219715a277d70aecb0d4c614b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
What does it mean to concatenate files? Find an image of an example concatenated file. Why would we want to concatenate files? | |
To concatenate files means to join multiple separate files into one. | |
Image of a concatenated file:http://speedrak.com/blog/how-to-combine-css-stylesheets-wordpress/ | |
Concatenating files allows us to minimize the number of requests sent to the server. Server requests are costly. It takes time to establish an HTTP connection | |
What does it mean to precompile files? What does this have to do with coffeescript and sass files? | |
To put a file into the most effecient, ready to use format. | |
Coffeescript and Sass are built on javascript. They are 'human readable' but the need to be compiled back into javascript before they can be used by the computer | |
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 means stripping out whitespace; making the file as small and easy to transmit as possible. | |
Image of a minfied file:http://speedrak.com/blog/how-to-minify-javascript-and-stylesheets/ | |
Making the file as small as possible decreases transmit and load time; decreases bandwidth drain of sending a file. Ergo decreases cost and loads faster (possibly improving profit) | |
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 page we see at http://localhost:3000/assets/application.js is the concatenated and preprocessed javascript for the entire application. It is combined CSS, SASS and coffeescript as well as any javascript that was written. | |
What is a manifest (in terms of the asset pipeline)? Where can you find two manifests in Catch 'em All? | |
A manifest is a list of files to include and serve(concatenate, minify, and preprocess) | |
I think there are 2 separate manifiests in the assets/application.js file | |
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? | |
It's put into the base application.html.erb template | |
How is a digest/fingerprint used on the assets for caching purposes? | |
Rails makes a hash from the contents of a file, like a css file and appends it to the end of the file name. When the file contents change, the hash changes and the filename changes. This way Rails can know when a file has not changed and does not have to waste resources re-requesting something it has already cached. | |
Done? Take a look at RailsGuides: The Asset Pipeline. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just to clarify- Sass is built on CSS and will compile down to CSS.