Skip to content

nightsailer/padrino-sprockets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Integrate sprockets with padrion

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages