Redmine 3.3.0 (ruby on rails 4.2.6) stylesheets not generated/included in application.css

后端 未结 1 405
执笔经年
执笔经年 2021-01-27 16:51

I have installed redmine, managed to get it started but the UI seems to be missing it\'s css styles. If I follow the link for application[SomeId].css It show me an empty css con

1条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-27 17:31

    Apparently my blunder was that I didn't run 'Redmine' at all in development mode. As I understand until now, the ruby on rails asset pipeline wasn't fired up to generate the concatenated application.css. All I had to do was to run the server once in development mode.

    rake assets:precompile
    rails server -e development
    

    Also found some useful info in this answer: Rails assets not precompiling, css looks different in production and Rails 4: assets not loading in production

    This is my first encounter with RoR and I blindly followed an install tutorial for 'Redmine' that didn't include the compile step.

    Edit The issue returned, actually it wasn't even fixed properly. Had to solve some issues with mysql2 adapter and login credentials in order to properly populate the database. After that I tried a lot of things until finally arriving to this steps list:

    Added in environments/production.rb

    config.serve_static_files = true
    config.assets.compile = true
    config.assets.precompile =  ['*.js', '*.css', '*.css.erb'] 
    config.assets.digest = true
    
    • Kill the server
    • Clear out tmp/cache/assets
    • Delete public/assets
    • Run rake assets:precompile
    • Start up the server rails s -e production
    • Reloading the page

    Run in cmd:

    set RAILS_ENV=production
    rake generate_secret_token
    
    set RAILS_ENV=production
    rake db:migrate
    
    set RAILS_ENV=production
    rake redmine:load_default_data
    
    set RAILS_ENV=production
    rake tmp:cache:clear
    
    set RAILS_ENV=production
    rake assets:precompile
    
    set RAILS_ENV=production
    rails server -e development
    

    If I visited the page and opened up web inspector, when I clicked the elink for application.css I still got the empty .css

    Eventually I figured out that instead that the gziped version had a size of 1kb which was intriguing. I deleted it and VOILA, it worked. Basically I solved my issue, but I still don't know why the gzip is generated with the empty css.

    0 讨论(0)
提交回复
热议问题