Commit 939383ef authored by Maxwell Salzberg's avatar Maxwell Salzberg

You can now use rake assets:precompile to upload all of your static assets to...

You can now use rake assets:precompile to upload all of your static assets to s3.  This uses your prexisiting settings in AppConfig for s3. then, start your server with ASSET_HOST={cdn_hostname} remember to include https and no trailing slash
parent e1658f8d
......@@ -38,7 +38,7 @@ module ApplicationHelper
end
def jquery_include_tag
javascript_include_tag('//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js') +
"<script src='//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js' type='text/javascript'></script>".html_safe +
content_tag(:script) do
"!window.jQuery && document.write(unescape(\"#{escape_javascript(include_javascripts(:jquery))}\")); jQuery.ajaxSetup({'cache': false});".html_safe
end
......
......@@ -54,12 +54,11 @@
/ bootstrap/blueprint switch
- if @aspect == :getting_started || @page == :logged_out
= stylesheet_link_tag "bootstrap.min.css"
= include_stylesheets :bootstrap
- else
= stylesheet_link_tag "blueprint/screen", :media => 'screen'
= stylesheet_link_tag "blueprint/print", :media => 'print'
= include_stylesheets :blueprint, :media => 'screen'
= stylesheet_link_tag "login", :media => 'screen'
= include_stylesheets :login, :media => 'screen'
= include_stylesheets :default, :media => 'all'
- if rtl?
......@@ -78,7 +77,7 @@
= csrf_meta_tag
<!--[if IE]>
= javascript_include_tag "/javascripts/ie.js"
= include_javascripts :ie
<![endif]-->
= jquery_include_tag
......
<!-- Begin MailChimp Signup Form -->
<%= javascript_include_tag 'vendor/mailchimp/jquery126.min.js', 'vendor/mailchimp/jquery.validate.js', 'vendor/mailchimp/jquery.form.js' %>
<%= include_javascripts :mailchimp %>
<div id="mc_embed_signup">
<form action="http://joindiaspora.us1.list-manage.com/subscribe/post?u=d759919b94f9cdcf39d204f3f&amp;id=7b5ceb2f8b" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank">
......
......@@ -5,7 +5,6 @@ gzip_assets: off
javascripts:
jquery:
- public/javascripts/vendor/jquery-1.7.1.min.js
main:
- public/javascripts/vendor/underscore.js
- public/javascripts/vendor/backbone.js
......@@ -86,8 +85,15 @@ javascripts:
- public/javascripts/inbox.js
profile:
- public/javascripts/vendor/jquery.autoSuggest.custom.js
ie:
- public/javascripts/ie.js
stylesheets:
bootstrap:
- public/stylesheets/bootstrap.min.css
blueprint:
- public/stylesheets/blueprint/screen.css
login:
- public/stylesheets/login.css
default:
- public/stylesheets/application.css
- public/stylesheets/ui.css
......
......@@ -39,7 +39,9 @@ Diaspora::Application.configure do
# Enable serving of images, stylesheets, and javascripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"
if ENV['ASSET_HOST']
config.action_controller.asset_host = ENV['ASSET_HOST']
end
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
......
......@@ -5,7 +5,6 @@
if AppConfig[:airbrake_api_key].present?
require 'airbrake'
Airbrake.configure do |config|
puts AppConfig[:airbrake_api_key]
config.api_key = AppConfig[:airbrake_api_key]
end
end
\ No newline at end of file
namespace :assets do
task :precompile do
puts "compiling sass..."
system 'sass --update public/stylesheets/sass:public/stylesheets'
system 'bundle exec jammit'
puts "packaging assets....."
Jammit.package!
Rake::Task['assets:upload_to_s3'].invoke
end
task :upload_to_s3 => [:environment] do
s3_configuration = {
:bucket_name => AppConfig[:s3_bucket],
:access_key_id => AppConfig[:s3_key],
:secret_access_key => AppConfig[:s3_secret]
}
Jammit.upload_to_s3!(s3_configuration)
asset_host = "https://#{s3_configuration[:bucket_name]}.s3.amazonaws.com"
puts "NOTE: ENV['ASSET_HOST'] is now: #{asset_host}, but you may know your cdn url better than I"
puts "Please set this in your ENV hash in a production enviroment"
end
end
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment