No commit activity in last 3 years
No release in over 3 years
There's a lot of open issues
Padrino with Sprockets
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Padrino::Sprockets

Sprockets, also known as "the asset pipeline", is a system for pre-processing, compressing and serving up of javascript, css and image assets. Padrino::Sprockets provides integration with the Padrino web framework.

Installation

Install from RubyGems:

$ gem install padrino-sprockets

Or include it in your project's Gemfile with Bundler:

gem 'padrino-sprockets', :require => "padrino/sprockets"

Usage

Place your assets under these paths:

app/assets/javascripts
app/assets/images
app/assets/stylesheets

Register sprockets in your application:

class Redstore < Padrino::Application
  register Padrino::Sprockets
  sprockets  # :url => 'assets', :root => app.root
end

Now when requesting a path like /assets/application.js it will look for a source file in one of these locations :

  • app/assets/javascripts/application.js
  • app/assets/javascripts/application.js.coffee
  • app/assets/javascripts/application.js.erb

To minify javascripts in production do the following:

In your Gemfile:

# enable js minification
gem 'uglifier'
# enable css compression
gem 'yui-compressor'

In your app:

class Redstore < Padrino::Application
  register Padrino::Sprockets
  sprockets :minify => (Padrino.env == :production)
end

For more documentation about sprockets, have a look at the Sprockets gem.

Helpers Usage

sprockets

:root =>  'asset root' # default is app.root
:url => 'assets'  # default map url, location, default is 'assets'

Contributors