Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How disable assets compilation on heroku?

I'm trying to deploy my rails app to heroku using this turtorial:

https://devcenter.heroku.com/articles/getting-started-with-rails4

So, I use rails 4.1.1 and ruby 2.1.1

My Gemfile has gem 'rails_12factor', group: :production inside.

My application.rb:


require File.expand_path('../boot', __FILE__)

require 'rails/all'

Bundler.require(*Rails.groups)

module Charticus
  class Application  Rails::Application
    # Settings in config/environments/* take precedence over those specified here.
    # Application configuration should go into files in config/initializers
    # -- all .rb files in that directory are automatically loaded.

    # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
    # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
    # config.time_zone = 'Central Time (US & Canada)'

    # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
    # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
    # config.i18n.default_locale = :de
  end
end

I created file public/assets/manifest.yml

But when I deploy app to heroku - it compile all my js-files files to application.js and all css-files application.css. And I can't see it on app.heroku.com using firebug.

What I need to do with my configurations to see all my js and css files on app.heroku.com ? How disable assets precompiling and minification on heroku?

Help me please! Thanks

like image 496
bmalets Avatar asked May 15 '14 20:05

bmalets


2 Answers

lib/tasks/assets.rake

Rake::Task["assets:precompile"].clear
   namespace :assets do
     task 'precompile' do
     puts "Not pre-compiling assets..."
   end
end

You are done.

like image 93
Saqib R. Avatar answered Nov 14 '22 21:11

Saqib R.


I compare config/environments/development.rb and config/environments/production.rb.

And make production.rb asset configs like in development.rb:

Comment this lines:

  • config.serve_static_assets = false
  • config.assets.js_compressor = :uglifier
  • config.assets.compile = false
  • config.assets.digest = true

Then:

  1. Push my changes to git repo git push origin master
  2. Push changes to heroku git push heroku master
like image 34
bmalets Avatar answered Nov 14 '22 21:11

bmalets