Skip to content

Instantly share code, notes, and snippets.

@nmcolome
Created June 6, 2017 03:05
Show Gist options
  • Select an option

  • Save nmcolome/2fd2734693b989c313f5bb5c6416379d to your computer and use it in GitHub Desktop.

Select an option

Save nmcolome/2fd2734693b989c313f5bb5c6416379d to your computer and use it in GitHub Desktop.

Asset Pipeline Notes

  • What does it mean to precompile files? What does this have to do with Coffeescript and Sass files? Does it only have to do with Coffeescript and Sass files?

Precompile: To do a preliminary conversion before doing the final conversion. The precompile phase sets up the source code, database, etc., in such a way that the final phase is performed faster.

Precompile files means to combine assets into a single file into a single language that the browser can read and so they don't need to be retrieved in separate HTTP requests. This applies for every type of language, it turns it into html and css.

  • What does it mean to minify files? Why would we want to minify files?

To minify is the process of removing all unnecessary characters from source code without changing its functionality (it removes white space, new lines, comments, etc). We want to do this to reduce the amount of data that needs to be transferred (make source code "smaller" and improve performance) its lightweight and it takes the browser less time to load.

  • What does Sprockets do and how does it fit into the precompile / minify puzzle? Is a gem built into Rails and is responsible for compile and minifying our code.

A manifest is a central hub of all the files required to be compiled. Is a document that acts as a central hub for requiring dependencies or other files for that type (js, css) and that document is used as a thing that gets compiled into a single file for the browser.

caching, your browser doesn't need to reload an asset if it has loaded it before, that way it doesn't need to request it to the server so it will load the page faster next time you open it. Fingerprint is a way to differentiate assets already loaded, so the browser knows when something has changed (because it has a diff. fingerprint) Digest is the process of generating the hash (fingerprint)

  • Why do we want to use this tags and not a link_tag, sript_tag, etc:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment