Ruby on rails application.css是';行不通
这是我的application.css:Ruby on rails application.css是';行不通,ruby-on-rails,Ruby On Rails,这是我的application.css: /* * 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
/*
* 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 vendor/assets/stylesheets of plugins, if any, 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 top of the
* compiled file, but it's generally better to create a new file per style scope.
*
*= require bootstrap
*= require bootstrap-responsive
*= require style
由于某些原因,我的css样式都没有被应用。当我查看source和openapplication.css时,文件是完全相同的。它不是在编译它。application.js编译得很好
我的档案:
有什么想法吗
编辑:通过添加*/
来修复它。请确保您有:
# Enable the asset pipeline
config.assets.enabled = true
在config/application.rb中设置
另外,这有点像是在黑暗中拍摄,但你不需要这样的线条:
*=require_self
/*
*= require_self
*/
@import "bootstrap.css";
@import "bootstrap-responsive.css";
@import "style.css";
在其他事情之前。我总是使用sass导入来更精确地包含我的样式表。所以我的是这样的:
*=require_self
/*
*= require_self
*/
@import "bootstrap.css";
@import "bootstrap-responsive.css";
@import "style.css";
然后确保您的文件名为application.css.scss
,我们可以看看您的GEM文件吗?知道是什么原因造成的吗?我过去从未遇到过这个问题。如果使用rails s
浏览url时,命令行输出中是否有任何提示?重命名应用程序。由于语法错误,scss将抛出SASS错误。我已经纠正了错误!似乎我最后忘记了*/
:3令人沮丧!我花了90分钟才弄明白。唉。