What does it mean to concatenate files? Find an image of an example concatenated file. Why would we want to concatenate files?
- To append one file to another
- Merge data of one file with another (or multiple other files)
- Example image: http://i.stack.imgur.com/eaepe.png (something like this?)
- Intention for file concatenation: Minimize the number of requests made to the server, therefore optimizing client-side performance (such as enabling faster page load time)
- Specifies what files are to be processed by the asset pipeline
- Sass and Coffeescript are languages that use preprocessors to transform their syntax into CSS and Javascript, respectively. Sass and Coffeescript are included by default with Rails.
What does it mean to minify files? Find an image of an example minified file. Why would we want to minify files?
- Minification is the process of removing all unnecessary characters from source code without changing its functionality. Unncessary characters include white space characters, new line characters, comments, and sometimes block delimiters, which are used to add readability to the code but are not required for it to execute.
- This reduces the amount of data that needs to be processed, which goes back to performance optimization
- Example image: http://cdn.speedrak.com/images/blog-images/seoblogger-after-minify-css.PNG
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?
- Code in the js file was commented out
What is a manifest (in terms of the asset pipeline)? Where can you find two manifests in Catch 'em All?
- Directives files that determine which assets to include and serve
- Required portions in the application.css and application.js files
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?
- erb link tags in the app/views/application.html.erb
-
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>```
- 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.
- With each file update, a new hash string will be appended at the end of each asset file name. This process can force the browser to request the new updated files and eliminate browser caching the old asset issue.
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 becasue what we see within the browser is the concatenated file.
👍