diff options
author | Joshua Peek <josh@joshpeek.com> | 2011-03-21 18:05:56 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2011-03-21 18:05:56 -0500 |
commit | 77ad4ca058c9a845257cbeb58a84cf511bae1040 (patch) | |
tree | 5dddfb6671276b562ac237e8682585a87d0db6cc | |
parent | 3e7985c9c1a6899ac06857bd8e6f29b48ad87cea (diff) | |
download | rails-77ad4ca058c9a845257cbeb58a84cf511bae1040.tar.gz rails-77ad4ca058c9a845257cbeb58a84cf511bae1040.tar.bz2 rails-77ad4ca058c9a845257cbeb58a84cf511bae1040.zip |
Add sprockets task to compile assets
-rw-r--r-- | railties/lib/rails/application/configuration.rb | 4 | ||||
-rw-r--r-- | railties/lib/rails/tasks/assets.rake | 14 |
2 files changed, 17 insertions, 1 deletions
diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb index c74bcbedf2..6901748d04 100644 --- a/railties/lib/rails/application/configuration.rb +++ b/railties/lib/rails/application/configuration.rb @@ -9,7 +9,8 @@ module Rails :filter_parameters, :helpers_paths, :logger, :preload_frameworks, :reload_plugins, :secret_token, :serve_static_assets, :session_options, - :time_zone, :whiny_nils + :time_zone, :whiny_nils, + :compile_assets attr_writer :log_level @@ -28,6 +29,7 @@ module Rails @log_level = nil @middleware = app_middleware @generators = app_generators + @compile_assets = [] end def compiled_asset_path diff --git a/railties/lib/rails/tasks/assets.rake b/railties/lib/rails/tasks/assets.rake new file mode 100644 index 0000000000..b6604a49c2 --- /dev/null +++ b/railties/lib/rails/tasks/assets.rake @@ -0,0 +1,14 @@ +namespace :assets do + task :compile => :environment do + env = Rails.application.assets + + assets = Rails.root.join("public/assets") + assets.mkdir unless assets.exist? + + Rails.application.config.compile_assets.each do |path| + assets.join(path).open('w') do |f| + f.write env[path].to_s + end + end + end +end |