Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A Ruby Gem for compiling assets through Sprock.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .rspec
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 Rakefile
Octocat-spinner-32 readme.md
Octocat-spinner-32 sprock_assets.gemspec
readme.md

SprockAssets

Build Status Dependency Status

SprockAssets is a Rack middleware that makes compiling your assets easy and fast.

Usage

Here is how to use it.

Add it to your Gemfile

gem 'sprock-assets', require: 'sprock_assets'

Rack apps

Add a use to your config.ru

use SprockAssets

Sinatra

You can use assets just like in Rails.

require 'sinatra/base'
require 'sprock_assets'

class MyApp < Sinatra::Base
  use SprockAssets
end

Create and update the source files

Source Path Compiled Path
app/assets/stylesheets/application.css public/assets/stylesheets/application.css
app/assets/javascripts/application.js public/assets/javascripts/application.js

Serve compiled assets

ruby config.ru
curl http://localhost/assets/stylesheets/application.css
curl http://localhost/assets/javascripts/application.js

Your compiled assets will now be served at their corresponding URIs. When your application is run in production your assets will automatically be compiled and saved to disk.

Notes

Make sure you require the compressors if you use SprockAssets in production.

gem 'yui-compressor', require: 'yui/compressor'
gem 'uglifier', require: 'uglifier'

License

WTFPL © 2012 Nick Barth

Something went wrong with that request. Please try again.