Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 3 - Asset Pipeline -- What does it mean to me?

I am struggling to find any real documentation on the new Rails 3 asset pipeline. I know there is a video, but I do not wish to watch an hour video in this format. I watched about 10 minutes and gained no knowledge.

So, what do I need to know about Rails 3 asset pipelines? What does this mean to my previous projects, and what does it mean to my future projects?

like image 712
Serodis Avatar asked Jun 05 '11 16:06

Serodis


People also ask

What is the Rails asset pipeline?

1 What is the Asset Pipeline? The asset pipeline provides a framework to concatenate and minify or compress JavaScript and CSS assets. It also adds the ability to write these assets in other languages and pre-processors such as CoffeeScript, Sass, and ERB.

What does rails assets Precompile do?

The Rails asset pipeline provides an assets:precompile rake task to allow assets to be compiled and cached up front rather than compiled every time the app boots. There are two ways you can use the asset pipeline on Heroku. Compiling assets locally. Compiling assets during slug compilation.

What are rails Sprockets?

Sprockets is a Ruby library for compiling and serving web assets. Sprockets allows to organize an application's JavaScript files into smaller more manageable chunks that can be distributed over a number of directories and files. It provides structure and practices on how to include assets in our projects.

What is the use of public folder in Rails?

public. The public directory contains some of the common files for web applications. By default, HTML templates for HTTP errors, such as 404, 422 and 500, are generated along with a favicon and a robots. txt file.


1 Answers

It means you will now be able to write css and javascript in separate files using sass and coffeescript if you want and they will be compiled into one single file in the end.

If you have like, 4 css files on your assets/stylesheets they will be concatenated and compressed and delivered on production with a single application.css file.

Same thing applies to javascript files.

More info in http://getsprockets.org/

like image 132
Draiken Avatar answered Dec 10 '22 00:12

Draiken