The Warped Asset Pipeline

Brought to you by ninefold.com

@mookiy

 

(ノ◕ヮ◕)ノ*:・゚✧

History Lesson!

The Core

Drama!

Magical Pipe!

RTFM

Make your own warping noises

TL;DR

Concatenation

Compression

Precompilation

Main Features

Concatenation

Compression

Precompilation

yeah it's the

wrong meme

Manifest Destiny

And the others?

Images

 

Text files

 

AV files

Fingerprints

Prod vs Dev

Dev

rails server
config/environment/development.rb
config.assets.compile = true

Compilation on the fly

Local Prod

rails server -e production
config/environment/production.rb 
config.assets.compile = false

Assumes assets are precompiled

rake assets:precompile

rake assets:precompile ?

No problem!

We will do that for you :)

Fastest Demo Ever

Tips and Tricks

Testing locally in prod

$ git checkout -b test-prod
$ RAILS_ENV=production bundle exec rake assets:precompile
$ rails s -e production

What happened?!

config/environment/production.rb
config.serve_static_assets = true

The hero to the rescue!

$ rails s -e production

CSS, I secretly hate you

background-image: url(“/assets/pic.jpg”);
background-image: url(image_path("pic.jpg"));
background: image-path("pic.jpg");
background-image: url(<%= asset_path 'pic.jpg' %>);
background-image: image-url("pic.jpg");

Rails 3.2.x users

gem 'turbo-sprocket-rails'

Thank you!

 

Questions?

Rails and the Warped Asset Pipeline

By rbatta

Rails and the Warped Asset Pipeline

  • 668