我创建了一个全新的Rails 3.1应用程序.我在app / assets / stylesheets / bootstrap.min.css中添加了twitter bootstrap CSS文件.这是相关的代码
app / assets / stylesheets / application.css(包括树,所以包含bootstrap)
/* * This is a manifest file that'll automatically include all the stylesheets available in this directory * and any sub-directories. 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_self *= require_tree . */
Gemfile(包括用于编译/压缩的execjs和therubyracer)
group :development,:qa do gem 'execjs' gem 'therubyracer' end # Gems used only for assets and not required # in production environments by default. group :assets do gem 'sass-rails','~> 3.1.0' gem 'coffee-rails','~> 3.1.0' gem 'uglifier','>= 1.0.3' end
然后我运行rake任务来预编译资产
rake assets:precompile
这失败,出现以下错误
Invalid CSS after ".inputs-list li+": expected number or function,was "li"
CSS在引导程序文件中(“.inputs-list li li”是选择器).
但是,如果我跑
rake assets:precompile RAILS_ENV=development
现在它工作正常.事实证明,如果我将config / environments / production.rb更改为不压缩文件:
config.assets.compress = false
那么原始命令也可以工作(没有指定开发环境).
那么,我该如何追踪错误?我现在可以忍受只是关闭压缩,但显然有些不对劲.是Rails吗?链轮?ruby赛车? Uglifier?
解决方法
我使用非缩小版的Bootstrap修复了这个问题.在运行rake资产时它仍然会被编译:预编译所以它不是问题:)
原文地址:https://www.jb51.cc/css/215647.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。