Redmine 3.3.0(rails上的ruby版本4.2.6)样式表未生成/包含在application.css中 [英] Redmine 3.3.0 (ruby on rails 4.2.6) stylesheets not generated/included in application.css

查看:283
本文介绍了Redmine 3.3.0(rails上的ruby版本4.2.6)样式表未生成/包含在application.css中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装了redmine,设法让它开始,但UI似乎缺少它的CSS样式。如果我按照应用程序的链接[SomeId] .css它给我一个空的css包含以下消息:

  / * 
*这是一个将编译成application.css的清单文件,它将包括下面列出的所有文件
*。
*
*此目录中的任何CSS和SCSS文件,lib / assets / stylesheets,vendor / assets / stylesheets,
*或任何插件的vendor / assets / stylesheets目录相对路径。
*
*您可以向此文件中添加应用程序范围的样式,它们将显示在
*编译文件的底部,因此您在此处添加的样式优先于样式以任何样式定义
*在此目录中的其他CSS / SCSS文件中定义。通常最好每个样式范围创建一个新的
*文件。
*
* /

production.log 似乎很好

 由WelcomeController处理#index为HTML 
当前用户:anonymous
呈现的欢迎/索引。 html.erb在layouts / base(1.0ms)
完成200 OK在18ms(视图:9.5ms | ActiveRecord:4.0ms)
开始GET/assets/application-e80e8f2318043e8af94dddc2adad5a4f09739a8ebb323b3ab31cd71d45fd9113.cssfor :: 1于2016-09-16 01:34:36 +0300
开始GET/assets/application-c2899b9307d416d19b1525a85be8085b93df756e91a5b0ee50ab1333f5ade73a.jsfor :: 1于2016-09-16 01:34:36 +0300

.htaccess

 < IfModule mod_fastcgi.c> 
AddHandler fastcgi-script .fcgi
< / IfModule>
< IfModule mod_fcgid.c>
AddHandler fcgid-script .fcgi
< / IfModule>
Options + FollowSymLinks + ExecCGI

RewriteEngine On

RewriteRule ^ $ index.html [QSA]
RewriteRule ^([^。] +)$ $ 1.html [QSA]
RewriteCond%{REQUEST_FILENAME}!-f
< IfModule mod_fastcgi.c>
RewriteRule ^(。*)$ dispatch.fcgi [QSA,L]
< / IfModule>
< IfModule mod_fcgid.c>
RewriteRule ^(。*)$ dispatch.fcgi [QSA,L]
< / IfModule>

ErrorDocument 500< h2>应用程序错误< / h2> Rails应用程序无法正常启动




  • redmine 3.3.0

  • ruby​​ 2.2.4 >
  • rails 4.2.6

  • latest xampp xampp-win32-7.0.9-1-VC14-installer



有关如何解决此问题的任何想法吗?

解决方案

显然我的错误是我没有在开发模式下运行Redmine。正如我明白到目前为止,rails资产管道上的ruby没有激发产生连接的 application.css 。所有我需要做的是在开发模式下运行服务器一次。

  rake assets:precompile 
rails server - e开发

在此答案中还找到一些有用的信息: Rails资产不预编译,css看起来不同的生产 Rails 4:资产未加载到生产中



这是我第一次遇到RoR,我盲目地遵循安装教程

编辑
返回的问题,实际上它甚至没有正确修复。必须解决与 mysql2 适配器和登录凭据的一些问题,以正确填充数据库。之后,我尝试了很多东西,直到最终到达这个步骤列表:



environments / production.rb b
$ b

  config.serve_static_files = true 
config.assets.compile = true
config.assets.precompile = ['* .js ','* .css','* .css.erb']
config.assets.digest = true


b $ b


  • 停止服务器

  • 清除tmp / cache / assets

  • 删除公共/ / li>
  • 运行rake assets:precompile

  • 启动服务器rails s -e production

  • / li>


在cmd中执行:

 设置RAILS_ENV =生产
rake generate_secret_token

设置RAILS_ENV =生产
rake db:migrate

设置RAILS_ENV =生产
rake redmine:load_default_data

set RAILS_ENV = production
rake tmp:cache:clear

set RAILS_ENV = production
rake assets:precompile

设置RAILS_ENV =生产
rails服务器-e开发

如果我访问了页面并打开web检查员,当我点击 application.css 的elink我仍然有空的.css



而是gziped版本有1kb的大小,这是有趣的。我删除它和VOILA,它的工作。基本上我解决了我的问题,但我仍然不知道为什么gzip生成与空css。


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 containing the following message:

 /*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
 * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any styles
 * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
 * file per style scope.
 *
 */

production.log seems fine

  Processing by WelcomeController#index as HTML
  Current user: anonymous
  Rendered welcome/index.html.erb within layouts/base (1.0ms)
Completed 200 OK in 18ms (Views: 9.4ms | ActiveRecord: 4.0ms)
Started GET "/assets/application-e80e8f2318043e8af94dddc2adad5a4f09739a8ebb323b3ab31cd71d45fd9113.css" for ::1 at 2016-09-16 01:34:36 +0300
Started GET "/assets/application-c2899b9307d416d19b1525a85be8085b93df756e91a5b0ee50ab1333f5ade73a.js" for ::1 at 2016-09-16 01:34:36 +0300

.htaccess

<IfModule mod_fastcgi.c>
    AddHandler fastcgi-script .fcgi
</IfModule>
<IfModule mod_fcgid.c>
    AddHandler fcgid-script .fcgi
</IfModule>
Options +FollowSymLinks +ExecCGI

RewriteEngine On

RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
<IfModule mod_fastcgi.c>
    RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
</IfModule>
<IfModule mod_fcgid.c>
    RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
</IfModule>

ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"

  • redmine 3.3.0
  • ruby 2.2.4
  • rails 4.2.6
  • latest xampp xampp-win32-7.0.9-1-VC14-installer

Any idea on how to fix this?

解决方案

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.

这篇关于Redmine 3.3.0(rails上的ruby版本4.2.6)样式表未生成/包含在application.css中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆