https://github.com/logandk/sprockets-compressor
Minified Sprockets Javascript output
https://github.com/logandk/sprockets-compressor
Last synced: about 1 year ago
JSON representation
Minified Sprockets Javascript output
- Host: GitHub
- URL: https://github.com/logandk/sprockets-compressor
- Owner: logandk
- License: mit
- Created: 2009-04-09T19:16:42.000Z (about 17 years ago)
- Default Branch: master
- Last Pushed: 2009-11-01T21:45:12.000Z (over 16 years ago)
- Last Synced: 2024-05-03T03:16:58.105Z (about 2 years ago)
- Language: Ruby
- Homepage:
- Size: 859 KB
- Stars: 9
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- License: MIT-LICENSE
Awesome Lists containing this project
README
sprockets-compressor - Minified Sprockets output
=================================================
This is a Ruby on Rails plugin, which passes Sprockets output through YUI Javascript compressor.
Installation
============
As a Rails Plugin
-----------------
Use this to install as a plugin in a Ruby on Rails app:
$ script/plugin install git://github.com/logandk/sprockets-compressor.git
As a Rails Plugin (using git submodules)
----------------------------------------
Use this if you prefer the idea of being able to easily switch between using edge or a tagged version:
$ git submodule add git://github.com/logandk/sprockets-compressor.git vendor/plugins/sprockets-compressor
Usage
=====
To enable compression, set `Sprockets.compression = true`. If you want to enable compression for a specific environment, say `production`, put this in `config/environments/production.rb`:
config.after_initialize do
Sprockets.compression = true
end
This plugin simply overrides the `save_to` method of the `Sprockets::Concatenation` class, to pass the output through *YUI Compressor*. When you have enabled compression
Sprockets will automatically create compressed javascript output when the `save_to` method is called.
secretary = Sprockets::Secretary.new({ ... })
secretary.concatenation.save_to("file.js")
In the above example, `file.js` would be a compressed javascript file.
Credits
=======
[YUI Compressor](http://developer.yahoo.com/yui/compressor/) is developed by Yahoo. [Sprockets](http://github.com/sstephenson/sprockets/tree/master) is developed by Sam Stephenson.
Copyright (c) 2009 Logan Raarup, released under the MIT license