Closed ggrillone closed 11 years ago
Are you loading Jammit correctly when booting your Rails app? If you open a Rails console and type Jammit
, is it there?
Yes on my localhost. Did you mean on the server? When executing cap deploy, it says jammit command finished successfully.
Also just noted in the jammit it docs (http://documentcloud.github.com/jammit/#configuration), it says if using nginx, add the following inside of server { ... }:
location ~ ^/assets/ {
passenger_enabled on;
expires max;
}
Tried it but when restarting nginx got a "nginx: [emerg] unknown directive "passenger_enabled"", assuming it's because I'm using unicorn, so if I change to 'unicorn_enabled on;' should that work?
Also, here's my assets.yml configuration in case it might be an issue with that:
package_assets: always
compress_assets: on
embed_assets: off
gzip_assets: off
javascript_compressor: uglifier
javascripts:
globals:
- .js files....
Yep -- when opening a console on the server. If you're not using passenger, don't worry about the nginx configuration.
When I run jammit, it pauses for a second or 2 (i'm assuming minifying files), and then returns the command prompt
Maybe I'm simply running the jam task too early or late? According to the docs "In production, you'll want to run Jammit during deployment, somewhere in between updating the source and symlinking to the new release"
Oh wait, just realized it is run before: deploy:update_code, so I'll have to try and run it after that
I don't think this has anything to do with the jammit
task. I think this has to do with not loading the library correctly in your app on the server. Anyhow -- I probably can't be of much help to you, I'm afraid. Good luck debugging.
hmmm... so the strangest thing happened.. So we set-up a new staging server, with the exact same configurations as the production server. I didn't change any of the code that I've mentioned here, except this time jammit did work? Any ideas why this could be?
My jammit CSS and JS doesn't load. I am getting following error on DigitalOcean.
ActionView::Template::Error (undefined method include_stylesheets' for #<#<Class:0x000000041900b0>:0x00000004196fa0>): 2: %html 3: %head 4: %title= Settings.app_name 5: = include_stylesheets :canvas, :media => 'all' 6: = include_javascripts :canvas 7: = javascript_include_tag 'home/custom.js.coffee' 8: = csrf_meta_tags app/views/layouts/home.html.haml:5:in
_app_views_layouts_home_html_haml__2155835962579908780_34422980'
app/controllers/website/home_controller.rb:11:in `home'
I followed http://stackoverflow.com/questions/24554448/jammit-gem-error-on-production these steps but same result. Any Solution??
I keep getting the following error in my production.log file: undefined method `include_javascripts', when using jammit it production. I created a rake task to minify the assets during deployment. Maybe my code is wrong, any suggestions?
Rake task:
Capistrano task: