README.md in classy_assets-0.10.0 vs README.md in classy_assets-0.11.0
- old
+ new
@@ -1,8 +1,8 @@
# ClassyAssets
-Classy Assets (powered by Sprockets) for Sinatra and Rack apps
+Sprockets-powered asset pipeline for classy Sinatra and/or Rack apps.
## Installation
Add this line to your application's Gemfile:
@@ -12,53 +12,59 @@
$ bundle
## Usage
-ClassyAssets is available as Rack Middleware or a Sintra Extension. The Sinatra Extension version integrates the [sprockets-helpers](https://github.com/petebrowne/sprockets-helpers) to provide helper methods for generating asset paths.
+ClassyAssets consists of a **Rack Middleware**, which integrates your app with [Sprockets](https://github.com/sstephenson/sprockets) to serve your assets, and a **Sintra Extension**, which provides helper methods for generating asset paths.
-Use the Rack Middleware directly:
+Configure your environment:
````ruby
-require 'rack/classy_assets'
-class ClassyApp < Sinatra::Base
- use Rack::ClassyAssets, root: 'path/to/your/app/root/directory'
+require 'classy_assets'
+ClassyAssets.config do |config|
+ config.asset_root = File.expand_path('../../', __FILE__)
+ # asset_root is required and must be set.
+ # See below for complete list of options.
end
````
-Use the Sinatra Extension:
+Install the Rack Middleware (usually in `config.ru`):
````ruby
+require 'rack/classy_assets'
+use Rack::ClassyAssets
+````
+
+Install the Sinatra Extension:
+
+````ruby
require 'sinatra/classy_assets'
class ClassyApp < Sinatra::Base
register Sinatra::ClassyAssets
end
````
-Both the middleware and extension assume your assets are stored in the `root` directory, in the following layout:
+Available Configuration Options:
- /assets
- |_ images
- |_ stylesheets
- |_ javascripts
-
-Sass and CoffeeScript are fully supported.
-
-Available Options:
-
-Pass these in via the options hash if you're using the rack middleware.
-If you're using the sinatra extension, then configure your app's `settings` after the `register Sintra::ClassyAssets` statement to override the defaults
-
````ruby
- :root # => path to root of the application. set by default in Sinatra apps, but must be explictly passed to the rack middleware, if used directly
- :public_folder # => path to public folder for the application. (default: File.join(root, 'public') )
- :assets_prefix # => currently does nothing useful (default: 'assets')
- :asset_host # => used by Sprockets::Helpers to return asset path prefixed by asset_host uri (default: nil)
- :digest_assets # => enable digest version of assets? true or false (default: false)
- :css_compressor # => instance of a sprokets compatible css compressor class (default: ::YUI::CssCompressor.new)
- :js_compressor # => instance of a sprokets compatible js compressor class (default: ::Uglifier.new)
- :sprockets # => instance of Sprockets::Environment. Should almost never need to be set manually. (default: Sprockets::Environment.new(root) )
+ :asset_root # => (String) path to root of the application (required, must be set before configuring other options)
+ :asset_cache # => (Boolean) enable/disable Sprockets environment caching (default: true in production, false in all other environments)
+ :asset_compress # => (Boolean) enable/disable asset compression (default: nil)
+ :asset_debug # => (Boolean) enable/disable asset debugging (default: true in development, false in all other environments)
+ :asset_digest # => (Boolean) enable/disable asset digests (default: nil)
+ :asset_host # => (String) CDN hostname to use when building asset urls (default: nil)
+ :asset_manifest_path # => (String) path to output Sprockets manifest file (default: asset_precompile_path + "manifest.json")
+ :asset_paths # => (Array) array of paths to add to the Sprockets environment (default: all paths under File.join(asset_root, asset_prefix))
+ :asset_precompile # => (Array) array of files to precompile. Globs and Regular Expressions are allowed. (default: [/\w+\.(?!js|css).+/, /application.(css|js)$/])
+ :asset_precompile_keep # => (Integer) number of precompiled asset versions to keep (default: 2)
+ :asset_precompile_path # => (String) path to output precompiled assets to (default: File.join(asset_public_path, asset_prefix))
+ :asset_prefix # => (String) name of the directory assets should be stored/served under (default: 'assets')
+ :asset_public_path # => (String) path to your app's public folder (default: File.join(asset_root, 'public'))
+ :asset_version # => (String) arbitrary asset version, used by Sprockets (default: the version of ClassyAssets in use)
+ :css_compressor # => (Symbol) name of a css compressor registered with Sprockets (default: :yui)
+ :js_compressor # => (Symbol) name of a javascript compressor registered with Sprockets (default: :uglifier)
````
+
## Project Status
- Build: [![Build Status](https://secure.travis-ci.org/styleseek/classy_assets.png?branch=master)](https://travis-ci.org/styleseek/classy_assets)
- Code Quality: [![Code Climate](https://codeclimate.com/github/styleseek/classy_assets.png)](https://codeclimate.com/github/styleseek/classy_assets)
- Dependencies: [![Dependency Status](https://gemnasium.com/styleseek/classy_assets.png)](https://gemnasium.com/styleseek/classy_assets)