aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Gemfile5
-rw-r--r--Gemfile.lock10
-rw-r--r--app/assets/stylesheets/application.css3
-rw-r--r--config/application.rb12
-rw-r--r--config/environments/development.rb7
-rw-r--r--config/environments/production.rb17
6 files changed, 53 insertions, 1 deletions
diff --git a/Gemfile b/Gemfile
index 186251de4..166e81af0 100644
--- a/Gemfile
+++ b/Gemfile
@@ -52,6 +52,11 @@ gem 'routing-filter'
gem 'unicode'
gem 'unidecoder'
+group :assets do
+ gem 'sass-rails', "~> 3.1"
+ gem 'uglifier'
+end
+
group :test do
gem 'fakeweb'
gem 'coveralls', :require => false
diff --git a/Gemfile.lock b/Gemfile.lock
index 989920a72..3ea1d3890 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -85,6 +85,7 @@ GEM
eventmachine (1.0.3)
exception_notification (3.0.1)
actionmailer (>= 3.0.4)
+ execjs (2.0.1)
factory_girl (2.6.4)
activesupport (>= 2.3.9)
factory_girl_rails (1.7.0)
@@ -202,6 +203,10 @@ GEM
vpim (>= 0.360)
ruby-ole (1.2.11.6)
sass (3.2.9)
+ sass-rails (3.1.0)
+ actionpack (~> 3.1.0)
+ railties (~> 3.1.0)
+ sass (>= 3.1.4)
simplecov (0.7.1)
multi_json (~> 1.0)
simplecov-html (~> 0.7.1)
@@ -235,6 +240,9 @@ GEM
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.37)
+ uglifier (2.2.1)
+ execjs (>= 0.3.0)
+ multi_json (~> 1.0, >= 1.0.2)
unicode (0.4.4)
unidecoder (1.1.2)
vpim (0.695)
@@ -289,10 +297,12 @@ DEPENDENCIES
rspec-rails
ruby-debug
ruby-msg (~> 1.5.0)
+ sass-rails (~> 3.1)
spork-rails
statistics2 (~> 0.54)
syslog_protocol
thin
+ uglifier
unicode
unidecoder
vpim
diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css
new file mode 100644
index 000000000..9f66182a9
--- /dev/null
+++ b/app/assets/stylesheets/application.css
@@ -0,0 +1,3 @@
+/* ...
+*= require_self
+*/
diff --git a/config/application.rb b/config/application.rb
index ad5d4b03f..422976215 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -6,7 +6,7 @@ require File.dirname(__FILE__) + '/../lib/configuration'
# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
-Bundler.require(:default, Rails.env) if defined?(Bundler)
+Bundler.require(:default, :assets, Rails.env) if defined?(Bundler)
module Alaveteli
class Application < Rails::Application
@@ -71,5 +71,15 @@ module Alaveteli
# Insert a bit of middleware code to prevent uneeded cookie setting.
require "#{Rails.root}/lib/whatdotheyknow/strip_empty_sessions"
config.middleware.insert_before ::ActionDispatch::Cookies, WhatDoTheyKnow::StripEmptySessions, :key => '_wdtk_cookie_session', :path => "/", :httponly => true
+
+ # Enable the asset pipeline
+ config.assets.enabled = true
+
+ # Version of your assets, change this if you want to expire all your assets
+ config.assets.version = '1.0'
+
+ # Change the path that assets are served from
+ # config.assets.prefix = "/assets"
+
end
end
diff --git a/config/environments/development.rb b/config/environments/development.rb
index a912dd5de..ecfad3af7 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -32,4 +32,11 @@ Alaveteli::Application.configure do
# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log
+
+ # Do not compress assets
+ config.assets.compress = false
+
+ # Expands the lines which load the assets
+ config.assets.debug = true
+
end
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 0c1929366..a3e3cebd2 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -31,4 +31,21 @@ Alaveteli::Application.configure do
if AlaveteliConfiguration::force_ssl
config.middleware.insert_before ActionDispatch::Cookies, ::Rack::SSL
end
+
+ # Compress JavaScripts and CSS
+ config.assets.compress = true
+
+ # Choose the compressors to use
+ # config.assets.js_compressor = :uglifier
+ # config.assets.css_compressor = :yui
+
+ # Don't fallback to assets pipeline if a precompiled asset is missed
+ config.assets.compile = false
+
+ # Generate digests for assets URLs.
+ config.assets.digest = true
+
+ # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
+ # config.assets.precompile += %w( search.js )
+
end