assets pipeline

What is assets pipeline?

It is a 3 step process

  1. precompile/pre-processing each asset (converting all .erb, .sass, .coffee etc.,)
  2. concatenate all assets into one gaint css & js asset (sprockets gem does this)
  3. minify assets (compression), to reduce amount of data transfer between browser and application

What does {{rake assets:precompile}} do?

It compiles, concatenates and minifies assets and moves them to public/, from where Webserver can access assets.

Good tutorials to understand assets pipeline

Can’t miss



> Web server can do two things

  • hosting assets
  • serving assets

> Assets are cached by rack cache (middleware)

> No code in public/ will ever be compiled by assets pipeline

> Default behavior of rails is assets pipeline is enabled

Useful tips

1. How to view all assets loaded


2. How to print all assets loaded from rails c.

On rails console

>> y Rails.application.config.assets.paths

3. How to access assets from URL of rails app


4. How to view inside a gem

$ bundle open <gem-name>