Plugin for the Padrino web framework which uses Sprockets to manage and compile assets
Ruby JavaScript
Switch branches/tags
Pull request Compare This branch is 1 commit ahead, 21 commits behind Cirex:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
.rspec
.travis.yml
.yardopts
CHANGELOG.md
Gemfile
LICENSE
README.md
Rakefile
padrino-assets.gemspec

README.md

Padrino Assets

Overview

Padrino assets is a plugin for the Padrino web framework which makes use of the Rack plugin Sprockets to manage and compile web assets.

Setup & Installation

Include it in your project's Gemfile with Bundler:

gem 'padrino-assets'

Modify your app/app.rb file to register the plugin:

class ExampleApplication < Padrino::Application

  # make sure this line is BELOW "register Padrino::Helpers"
  register Padrino::Assets

  # put this line if your server ignores config.ru file
  # like "padrino start" do
  use Padrino::Assets::App
end

Modify your config.ru file to mount the environment:

map '/assets' do
  run Padrino::Assets.environment
end

By default, Sprockets is configured to load assets from your project's app/assets and lib/assets directories. Any files stored in these directories are readily available to the included helpers and will be served by the Sprockets middleware.

Because of this the following directories are no longer used and will instead be served statically:

  • public/images
  • public/stylesheets
  • public/javascripts

You should now be storing your assets in the following directories:

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

Should your project need to add additional paths you can do so by adding the following line:

Padrino::Assets.load_paths << 'path/to/my/assets'

Dependencies

TODO

  • Additional documentation
  • Tests

Copyright

Copyright © 2012 Benjamin Bloch (Cirex). See LICENSE for details.