From 1844572fd129f03bc6741b3ae928b730133cf6e3 Mon Sep 17 00:00:00 2001 From: wycats Date: Thu, 16 Jun 2011 12:08:26 -0700 Subject: =?UTF-8?q?Make=20the=20API=20for=20compression=20consistent=C2=A0?= =?UTF-8?q?between=20JS=20and=20CSS.=20By=20default,=20users=20just=20need?= =?UTF-8?q?=20to=20say=20whether=20they=20want=20compression=20or=20not,?= =?UTF-8?q?=20and=20a=20default=20will=20be=20chosen=20by=20a=20Railtie.?= =?UTF-8?q?=20In=20the=20case=20of=20CSS,=20this=20default=20is=20already?= =?UTF-8?q?=20chosen=20by=20the=20sass-rails=20gem.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Users can still explicitly choose a compressor in their application.rb if they have a preference, but will usually want to let plugins choose defaults in their Railties. --- actionpack/lib/sprockets/railtie.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'actionpack/lib/sprockets') diff --git a/actionpack/lib/sprockets/railtie.rb b/actionpack/lib/sprockets/railtie.rb index 9fb66a1833..38eb00ce01 100644 --- a/actionpack/lib/sprockets/railtie.rb +++ b/actionpack/lib/sprockets/railtie.rb @@ -63,8 +63,12 @@ module Sprockets env.logger = Rails.logger - env.js_compressor = expand_js_compressor(assets.js_compressor) - env.css_compressor = expand_css_compressor(assets.css_compressor) + if assets.compress + # temporarily hardcode default JS compressor to uglify. Soon, it will work + # the same as SCSS, where a default plugin sets the default. + env.js_compressor = expand_js_compressor(assets.js_compressor || :uglifier) + env.css_compressor = expand_css_compressor(assets.css_compressor) + end env end -- cgit v1.2.3