From 602bac19e75347d642c7f5b86ff46dae2c32c4e5 Mon Sep 17 00:00:00 2001 From: Richard Hulse Date: Sun, 17 Jul 2011 20:12:30 +1200 Subject: [PATCH 1/2] [configuring] add doc for missing assets attribute .compress turns on the compression using the types specified in other config options --- railties/guides/source/configuring.textile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/railties/guides/source/configuring.textile b/railties/guides/source/configuring.textile index 8e6010ff79..7ed958be08 100644 --- a/railties/guides/source/configuring.textile +++ b/railties/guides/source/configuring.textile @@ -120,10 +120,12 @@ h4. Configuring Assets Rails 3.1, by default, is set up to use the +sprockets+ gem to manage assets within an application. This gem concatenates and compresses assets in order to make serving them much less painful. -* +config.assets.css_compressor+ defines the CSS compressor to use. Only supported value at the moment is +:yui+, which uses the +yui-compressor+ gem. - * +config.assets.enabled+ a flag that controls whether the asset pipeline is enabled. It is explicitly initialized in +config/application.rb+. +* +config.assets.compress+ a flag that enables the compression of compiled assets. It is explicitly set to true in +config/production.rb+. + +* +config.assets.css_compressor+ defines the CSS compressor to use. Only supported value at the moment is +:yui+, which uses the +yui-compressor+ gem. + * +config.assets.js_compressor+ defines the JavaScript compressor to use. Possible values are +:closure+, +:uglifier+ and +:yui+ which require the use of the +closure-compiler+, +uglifier+ or +yui-compressor+ gems respectively. * +config.assets.paths+ contains the paths which are used to look for assets. Appending paths to this configuration option will cause those paths to be used in the search for assets. From 5187264e19df0bb0e36150803e3c69b2e0e26a74 Mon Sep 17 00:00:00 2001 From: Richard Hulse Date: Sun, 17 Jul 2011 20:22:01 +1200 Subject: [PATCH 2/2] [asset pipeline] Correct CSS section and include Gem details Also added note about compress option, which was not mentioned anywhere and is required --- railties/guides/source/asset_pipeline.textile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/railties/guides/source/asset_pipeline.textile b/railties/guides/source/asset_pipeline.textile index 91285eec6c..4a1c623436 100644 --- a/railties/guides/source/asset_pipeline.textile +++ b/railties/guides/source/asset_pipeline.textile @@ -326,33 +326,32 @@ TODO: Apache instructions h3. Customizing The Pipeline -h4. CSS -There is currently one option for processing CSS - SCSS. This Gem extends the CSS syntax and offers minification. +h4. CSS Compression -The following line will enable SCSS in you project. +There is currently one option for compressing CSS - YUI. This Gem extends the CSS syntax and offers minification. + +The following line will enable YUI compression, and requires the +yui-compressor+ gem. -config.assets.css_compressor = :scss +config.assets.css_compressor = :yui -This option is for compression only and does not relate to the SCSS language extensions that apply when using the +.scss+ file extension on CSS assets. +The +config.assets.compress+ must be set to +true+ to enable CSS compression h4. Javascript -There are three options available to process javascript - uglifier, closure and yui. +Possible options for Javascript compression are +:closure+, +:uglifier+ and +:yui+. These require the use of the +closure-compiler+, +uglifier+ or +yui-compressor+ gems respectively. The default Gemfile includes "uglifier":https://github.com/lautis/uglifier. This gem wraps "UglifierJS":https://github.com/mishoo/UglifyJS (written for NodeJS) in Ruby. It compress your code by removing white spaces and other magical things like changing your if and else statements to ternary operators when possible. -TODO: Add detail about the other two - The following line will invoke uglifier for Javascript compression. config.assets.js_compressor = :uglifier - +The +config.assets.compress+ must be set to +true+ to enable Javascript compression h4. Using your own compressor @@ -418,3 +417,4 @@ h3. Making Your Library or Gem a Pre-Processor "You should be able to register [your gems] on "Tilt":Tilt and Sprockets will find them." - Josh [Tilt]https://github.com/rtomayko/tilt +