Skip to content

Instantly share code, notes, and snippets.

@acareaga
Last active November 11, 2015 16:58
Show Gist options
  • Save acareaga/5d68a9991be7469075aa to your computer and use it in GitHub Desktop.
Save acareaga/5d68a9991be7469075aa to your computer and use it in GitHub Desktop.

Asset Pipeline Notes

  • Concatenate files: combines stylesheets and javascripts into one file, loads faster

  • Precompile files: Translates Sass, Coffescript to plain CSS and Javascripts so rails can process the style easier by moving the translatde files to the public/assets folder

  • Minification takes out the extra whitespace and comments from your assets, faster load times

  • navigate to http://localhost:3000/assets/application.js: displays all the javascript code from app/lib/vendor and gem files

  • Manifest: application.js & application.css are the manifest that give directions for displaying all relevant code for each language built into the applciation

  • Files are referenced in the view/layouts/application.html.erb via:

    <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>

    <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>

  • Digest/fingerprint: makes the name of a file dependent on the contents of the file, when the contents change the filename changes. If nothing has changed and the file has already been loaded (no need to reload), renders the page faster

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment