Permalink
Browse files

configuration examples and readme

  • Loading branch information...
1 parent 95c3b9a commit eecfd27f48e1f6cb9f4ea1a88f1ece6f679c096d @thegorgon thegorgon committed Oct 25, 2011
Showing with 97 additions and 8 deletions.
  1. +19 −0 LICENSE.mkd
  2. 0 README.md
  3. +63 −0 README.mkd
  4. +13 −0 examples/configuration.rb
  5. +1 −1 lib/sinatra/sprockets/configuration.rb
  6. +1 −7 sinatra-sprockets.gemspec
View
@@ -0,0 +1,19 @@
+Copyright (c) 2011 Jesse Reiss
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
View
No changes.
View
@@ -0,0 +1,63 @@
+Sinatra Sprockets!
+====================
+
+Because Sprockets is cool, and Rails is cool, but they shouldn't get married.
+
+Installation
+------------
+
+Run
+
+ gem install sinatra-sprockets
+
+Or add
+
+ gem 'sinatra-sprockets'
+
+to your Gemfile
+
+Setup
+------------
+
+Sinatra Sprockets needs to be configured to work properly. In your server initialization, add a configuration :
+
+ Sinatra::Sprockets.configure do |config|
+ config.app = MyApp
+
+ ['stylesheets', 'javascripts', 'images'].each do |dir|
+ config.append_path(File.join('app', 'assets', dir))
+ end
+ end
+
+The only required field is `app` which is necessary to translate app configuration to Sprockets. You will also want to `append_paths` as none are included by default. See Configuration for more information.
+
+Include `Sinatra::Sprockets::Helpers` as helpers in your application :
+
+ helpers Sinatra::Sprockets::Helpers
+
+And mount the environment :
+
+ mount '/assets' do
+ run Sinatra::Sprockets.environment
+ end
+
+Configuration
+------------
+Sprockets requires a decent amount of configuration to work properly. Most of the options listed here are taken from the Sprockets/Rails integration. You can get more detailed information in the [Rails guide on asset pipelines](http://guides.rubyonrails.org/asset_pipeline.html).
+
+`digest` : Boolean value. Should Sprockets use "digest" asset paths? That is, should asset paths be fingerprinted using file digests for cache busting? For more information. This is on by default, though you may want to turn it off in development.
+
+`debug` : Boolean value. Should sprockets include assets for debugging? That is, should assets be rendered as individual included files for debugging or as the combination? When on, javascript and stylesheet debugging are much easier. Off by default, though you probably want to turn it on in development.
+
+`compile`: Boolean value.
+
+
+Known Issues
+------------
+
+There's no testing or documentation. I know. Want to help?
+
+Anything else?
+------------
+
+Questions, requests, concerns? Find me at [the gorgon lab](http://www.thegorgonlab.com)
@@ -0,0 +1,13 @@
+Sinatra::Sprockets.configure do |config|
+ config.app = MyApp
+
+ ['stylesheets', 'javascripts', 'images'].each do |dir|
+ config.append_path(File.join('app', 'assets', dir))
+ end
+
+ config.digest = true
+ config.compress = true
+ config.debug = false
+
+ config.precompile = ['application.js', 'vendor.js', 'application.css', /.+\.(png|ico|gif|jpeg|jpg)$/]
+end
@@ -4,7 +4,7 @@ class Configuration
DEFAULTS = {
:digest => true,
:debug => false,
- :compile => true,
+ :compile => false,
:compress => true,
:prefix => "assets",
:host => nil,
@@ -9,17 +9,11 @@ Gem::Specification.new do |s|
s.authors = ["thegorgon"]
s.email = ["jessereiss@gmail.com"]
s.homepage = "http://github.com/thegorgon/sinatra-sprockets"
- s.summary = %q{Use Sprockets effectively with Sinatra.}
+ s.summary = %q{Sinatra helpers for Sprockets integration.}
s.description = %q{Use Sprockets effectively with Sinatra.}
s.rubyforge_project = s.name
- gem 'uglifier'
- gem 'closure-compiler'
- gem 'yui-compressor', :require => "yui/compressor"
- gem 'execjs'
- gem 'therubyracer'
-
s.add_runtime_dependency 'sprockets', '~> 2.0.0'
s.add_runtime_dependency 'uglifier'
s.add_runtime_dependency 'closure-compiler'

0 comments on commit eecfd27

Please sign in to comment.