- It's when all of your code is complied into a transmitable single string that can be moved from server to user.
- Coffeescript is like a higher level version of javascript that almost looks like ruby. Once it's been compiled it looks a lot more like true javascript and is more ready to be "browser readable".
- To reduce the compiled code. Remove all unneccessary characters or white space and make the smallest possible transmitable piece of code without it losing its functionality.
- Because sites will load faster! Download from other machines takes less time.
- Sprockets comes built-in as of Rails 3.1 and is considered as an integral part of Rails.
- The asset pipeline is implemented by the sprockets-rails gem, and is enabled by default.
- Sprockets does the procompiling for Rails.
- A file that points to other files.
- Sprockets uses manifest files to determine which assets to include and serve. These manifest files contain directives - instructions that tell Sprockets which files to require in order to build a single CSS or JavaScript file. With these directives, Sprockets loads the files specified, processes them if necessary, concatenates them into one single file and then compresses them. By serving one file rather than many, the load time of pages can be greatly reduced because the browser makes fewer requests. Compression also reduces file size, enabling the browser to download them faster.
- It contains directives. It tells sprockets what to use.
- It requires everything below it in the tree system, all styles and everything else into 1 file. That is the only file the browser needs to read from.
/javascripts/movement.js
/stylesheets/application.css.scss
In regular HTML files, we import CSS files with . How is this done in a Rails project? Where do you see this line in Catch ‘em All?
- /views/application.html.erb
- This is the "stylesheet link tag"
- <%= stylesheet_link_tag "application" %>
- <%= javascript_include_tag "application" %>
- <%= image_tag "rails.png" %>
- Sprockets does not add any new methods to access your assets - you still use these familiar tags.