Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hojberg/rack-combobot
Asset combinator for rack
https://github.com/hojberg/rack-combobot
Last synced: 2 months ago
JSON representation
Asset combinator for rack
- Host: GitHub
- URL: https://github.com/hojberg/rack-combobot
- Owner: hojberg
- Created: 2011-09-27T09:30:59.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2012-05-02T20:48:33.000Z (over 12 years ago)
- Last Synced: 2024-09-17T22:44:34.075Z (3 months ago)
- Language: Ruby
- Homepage: https://github.com/hojberg/rack-combot
- Size: 164 KB
- Stars: 6
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# rack-combobot [![Build Status](https://secure.travis-ci.org/hojberg/rack-combobot.png)](http://travis-ci.org/hojberg/rack-combobot)
Asset combinator for rack
## Installation
`gem install rack-combobot`
## Path
Point your frontend to `/combobot?script1.js&script2.js` to get script1.js and script2.js combined.
### Usage in Rack apps (config.ru)
```ruby
require 'rack'
require 'rack-combobot'
require 'my-app'use Rack::Combobot, :root => '/public'
run MyApp
```### Usage in Rails apps
In your config/application.rb
```ruby
config.middleware.use 'Rack::Combobot', :root => "#{Rails.root}/public"
```### Expires header
Add expires header
```ruby
config.middleware.use 'Rack::Combobot', :root => "#{Rails.root}/public", :expires => Time.gm(2020)
```To bust the cache, simple add a unique string to your request like so `/combobot/BUSTINGSRING?script1.js&script2.js`.
### Without query string
If you environment doesn't allow having the file names in the query string (Like on CloudFront). Combobot will accept the file names as part of the url, but they have to start with `&`.