Skip to content

Instantly share code, notes, and snippets.

@julsfelic
Last active March 2, 2016 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julsfelic/dc03218f50d6a5a62b73 to your computer and use it in GitHub Desktop.
Save julsfelic/dc03218f50d6a5a62b73 to your computer and use it in GitHub Desktop.
Asset Pipeline Scavenger Hunt
  • 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 is to add files together.
    • Conecating Example.
    • You would conecatenate files to limit the amount of times we make a trip to the server.
  • What does it mean to precompile files? What does this have to do with coffeescript and sass files?

    • Before we send a file to the browser, we have to precompile it to a language that the browser can handle (HTML, CSS & JS).
    • If we are using a language that makes it easier to program in a certain language like Coffeescript, Sass or ERB, we have to first precompile it before serving it up to the browser.
  • What does it mean to minify files? Find an image of an example minified file. Why would we want to minify files?

    • Getting rid of any unecessary white space.
    • Minified file
    • The files won't be read, so we minify to cut down on the size of the file.
  • 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?

    • They are not the same because the asset pipeline automatically joins all your CSS & JS assets into one file to cut down on the number of requests we make to the database.
  • What is a manifest (in terms of the asset pipeline)? Where can you find two manifests in Catch 'em All?

    • It gives sprockets directives. They hold the instructions for which files to include in order to build the CSS & JS files for our application.
  • 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 a Rails project, we use the stylesheet_link_tag helper. You see this in the application.html.erb file in app/views/layouts
  • 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. Everytime we make a change to a asset file, the digest changes. The reason we do this is becuase if a client caches an asset, we need a way to tell the client that the asset has been updated and you should instead cache this newer version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment