0

After deploy on heroku does not work js (jquery). But on locale machine all well.

I have file (push_notification.js) with js in javascripts directory.

$((function(){
  $("#dv").attr('class', 'animated fadeInDown delay-0s')
  setTimeout(function () {
      $("#dv").attr('class', 'hidden')
  }, 6000)
}));

On heroku it does not work.

My application.js

//= require_self
//= require jquery
//= require jquery.turbolinks
//= require rails-ujs

//= require push_notification
//= require admin_panel
//= require_tree .

Pls prompt me, solution this problem

4
  • try assets precompile on heroku Commented Jun 5, 2019 at 17:23
  • I tried to run, but nothing changed Commented Jun 5, 2019 at 17:28
  • check any error in the console log. and try restarting your server Commented Jun 5, 2019 at 17:30
  • There are no problems, neither in the heroku logs nor in the browser console. Commented Jun 5, 2019 at 17:32

1 Answer 1

1

There are two ways you can use the asset pipeline on Heroku.

  1. Compiling assets locally.
  2. Compiling assets during slug compilation.

To compile your assets locally, run the assets:precompile task locally on your app. Make sure to use the production environment so that the production version of your assets are generated.

RAILS_ENV=production bundle exec rake assets:precompile

A public/assets directory will be created

git add public/assets
git commit -m "vendor compiled assets"

For more ref use this link enter link description here

Sign up to request clarification or add additional context in comments.

1 Comment

TY but i use like: "heroku run RAILS_ENV=production bundle exec rake assets:precompile" and it worked

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.