What is the difference between sprockets-rails and sprockets gem?

1.2k Views Asked by At

I am confused about which one of these two is the actual sprocket gem for rails? Which one should I be using? Whats the difference between the two?

sprockets-rails: https://github.com/rails/sprockets-rails

sprockets: https://github.com/sstephenson/sprockets

2

There are 2 best solutions below

0
On BEST ANSWER

The sprockets-rails includes rails based functionality and rake tasks.

In all current versions of Rails (beginning with 3.1), your Sprockets environment is automatically mounted at /assets.

Sprockets can be used in conjunction with a Rack app. See: https://github.com/rack/rack for more information regarding Rack apps.

0
On

The "sprockets" gem is for use in generally any ruby apps.

"Sprockets-rails" is like a wrapper around the "Sprocket" gem for use specifically for rails apps. The part of the name after the "-" dash means that its specific for certain frameworks/environments/gems..

For example. Other than sprocket-rails, there is also a wrapper for Sinatra called 'sprocket-sinatra', which is also a web application framework like rails. .

The same naming convention can exist for all gems, for example, the BDD testing framework cucumber.
You may find cucumber-rails, cucumber-js, cucumber-sinatra... etc –