Skip to content

Instantly share code, notes, and snippets.

@jk1dd
Last active April 12, 2017 15:54
Show Gist options
  • Save jk1dd/13ba66a1f2286f248beb52514326b084 to your computer and use it in GitHub Desktop.
Save jk1dd/13ba66a1f2286f248beb52514326b084 to your computer and use it in GitHub Desktop.
Asset Pipeline class questions
  • 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

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment