Skip to content

Instantly share code, notes, and snippets.

@Jbern16
Created April 20, 2016 15:29
Show Gist options
  • Save Jbern16/2f68534fb920b9960e7e74ccb06881da to your computer and use it in GitHub Desktop.
Save Jbern16/2f68534fb920b9960e7e74ccb06881da 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?
Combine files. This will increaase performance and provide an efficient package that our browser can interpret
What does it mean to precompile files? What does this have to do with coffeescript and sass files?
Sass -> CSS, CS -> JS. Our browser needs CSS/JS/HTML. Sass and CS abstractions of their base language/
What does it mean to minify files? Find an image of an example minified file. Why would we want to minify files?
Strip whitespace and uneeded data. This will increaase performance and provide an efficient package that our browser can interpret
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?
What is being shown in the browser is the raw jquery and base js code that is linked in the application.js file
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
What is a manifest (in terms of the asset pipeline)? Where can you find two manifests in Catch 'em All?
*= require_tree .
*= require_self
*/
You find this in the application.css /application.js file. This is showing which files to link to
In regular HTML files, we bring in css files with <link rel="stylesheet" href="application.css">. How is this done in a Rails project? Where do you see this line in Catch 'em All?
Everything is linked through the application.css and application.js.
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.
When the file contents change, the filename is also changed.
For content that is static or infrequently changed, this provides an easy way to tell whether two versions of a file are identical, even across different servers or deployment dates.
@Carmer
Copy link

Carmer commented Apr 20, 2016

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

These are what brings in the stylesheets and the javascript files in the html file itself.

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