I have declared in my assets.rb
Rails.application.config.assets.precompile += %w( ckeditor/* )
I have also precompiled my assets for production, the heroku logs don't give any errors and on my heroku server instead of getting cktext_area i get simple text_area
Related
The bootstrap and CSS work perfectly in development for our rails 4.2 app.
Here is the login page in development:
After deploying (ubuntu 14.1), assets are precompiled with:
bundle exec rake assets:precompile RAILS_ENV=production
However the bootstrap and css are completely not showing any effect on production server. Here is the same login page in production:
The assets precompile seems not having any effect on production. What's could cause bootstrap and css not showing in production? Is there way to verify that the assets precompile is successful?
UPDATE: files under app/assets
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
# config.assets.precompile += %w( search.js )
You might have to uncomment the above lines and add the js and css files you are compiling. Above line should be present in /config/environments/production.rb
When I run the app I deployed to Heroku, I get this error:
ActionView::Template::Error ('fontawesome.less' wasn't found
I've tried precompile the assets locally - this way:
bundle exec rake assets:precompile
The result:
...
FATAL: database "myapp_production" does not exist
...
When I run - heroku run rake assets:precompile, the result is:
...
'fontawesome.less' wasn't found
...
The setup in config/environments/production.rb:
config.assets.compile = true
What causes this problem?
Many thanks
You should resolve the database config issue to be able to compile assets locally.
The assets compiled will all be .css, not less.
Check config/application.rb, I for example have these lines there:
config.assets.paths << Rails.root.join("app", "assets", "flash")
config.assets.precompile += [ 'print.css', 'resume.css', 'application.css', 'reset-min.css', 'lightbox.css', 'bootstrap.css', 'grid.css' ]
config.assets.precompile += [ 'rails.js', 'application.js', 'bootstrap.js' ]
config.assets.enabled = true
config.assets.version = '1.0'
You need to have less-rails gem and the sufix of the file is .css.less
gem 'less-rails'
If you require the file separately of the application.js, you need to add the precompile array in environments/production.rb, and the extension of the file should be ".css.less"
config.assets.precompile += %w( fontawesome.css )
And be sure of you have enable the static_assets option in environments/production.rb
config.serve_static_assets = true
My development and test servers are working fine, but I am having trouble with the production server. Sequence:
RAILS_ENV=production bundle exec rake assets:precompile
sudo httpd service restart
When I try to go to my production server from a browser, I get the dreaded:
We're sorry, but something went wrong
Looking at production.log, I see:
ActionView::Template::Error (statics.css isn't precompiled)
So, I added the following to config/application.rb:
config.assets.precompile += ['statics.css']
Still got the error screen, now the production log says:
ActionView::Template::Error (statics.js isn't precompiled)
So, I added the following to config/application.rb:
config.assets.precompile += ['statics.js']
I precompiled assets and restarted the server, but I'm still getting the same error message:
ActionView::Template::Error (statics.js isn't precompiled)
I also tried the following:
config.assets.precompile += %w( *.css *.js )
config.assets.precompile += ('*.css','*.js')
config.assets.precompile += ('.css','.js')
but I keep getting the error:
ActionView::Template::Error (statics.js isn't precompiled)
These are all suggestions I found on stackoverflow. Any ideas?
This fixed the issue for me: Go to config/environments/production.rb and set config.assets.compile = true.
I'm using Rails on Heroku Cedar stack and it's not throwing any issues while compiling the assets but then I get a 500 internal server error:
2012-06-25T23:22:59+00:00 app[web.1]: ActionView::Template::Error (bootstrap-datepicker.js isn't precompiled):
Any idea what might be causing this? This is the javascript file I'm including (except I downloaded it locally) https://github.com/eternicode/bootstrap-datepicker/blob/master/js/bootstrap-datepicker.js
I'm including it in my application.html.erb like so:
<%= javascript_include_tag "bootstrap-datepicker" %>
Is it because its not a coffeescript file? Any help is appreciated!
I figured it out. I had to add it to production.rb in config.assets.precompile
In production.rb I added it to my config.assets.precompile:
config.assets.precompile += %w( jquery.dataTables.min.js jquery-ui-1.8.21.custom.min.js jquery-ui-1.8.21.custom.css bootstrap-datepicker.js fullcalendar.js)
I want to manually precompile some assets in my dev environment (to check the content of the compiled js and css files) from the command line.
I am running
RAILS_ENV=development bundle exec rake assets:precompile
but my js and css are not compiled in the public/assets folder, only the images are. Any idea why that may be happening?
Try adding this to your config/environments/production.rb :
config.assets.precompile += %w( *.css *.js )