Skip to content

Instantly share code, notes, and snippets.

@stevepentler
Forked from GregoryArmstrong/asset_pipeline.md
Created January 13, 2016 17:02
Show Gist options
  • Save stevepentler/7a0d2b50f215ca4b2536 to your computer and use it in GitHub Desktop.
Save stevepentler/7a0d2b50f215ca4b2536 to your computer and use it in GitHub Desktop.

What does it mean to concatenate files? Find an image of an example concatenated file. Why would we want to concatenate files?

  • To put them together so theyre treated as one. We might want to concatenate to send fewer files for the same amount of data.

What does it mean to precompile files? What does this have to do with coffeescript and sass files?

  • To grab database info all at once for faster successive calls. Coffeescript and Sass files are precompiled so that all of their libraries can be accessed.

What does it mean to minify files? Find an image of an example minified file. Why would we want to minify files?

  • To remove unneccesary things such as whitespace from files so that they're as small as they can be.

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 file on the server contains all JS used by the server, whereas the application.js in your editor is usually fairly empty as it is used to add custom JS to the total amount of JS for the app.

What is a manifest (in terms of the asset pipeline)? Where can you find two manifests in Catch 'em All?

  • A file containing meta-data for accompanying files. The application.js on the server would be one of these, the other would be application.css.

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?

  • This is handled by the application.html.erb file in Rails.

How is a digest/fingerprint used on the assets for caching purposes?

  • The assets filename/contents are fingerprinted together, so that if the file is changed the fingerprint changes and the remote users know to re-download the new content.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment