根据预编译期间的Rails 3.1资产管道,Twitter引导程序有无效的CSS?

前端之家收集整理的这篇文章主要介绍了根据预编译期间的Rails 3.1资产管道,Twitter引导程序有无效的CSS?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_403_1@我创建了一个全新的Rails 3.1应用程序.我在app / assets / stylesheets / bootstrap.min.css中添加了twitter bootstrap CSS文件.这是相关的代码

app / assets / stylesheets / application.css(包括树,所以包含bootstrap)

  1. /*
  2. * This is a manifest file that'll automatically include all the stylesheets available in this directory
  3. * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
  4. * the top of the compiled file,but it's generally better to create a new file per style scope.
  5. *= require_self
  6. *= require_tree .
  7. */

Gemfile(包括用于编译/压缩的execjs和therubyracer)

  1. group :development,:qa do
  2. gem 'execjs'
  3. gem 'therubyracer'
  4. end
  5. # Gems used only for assets and not required
  6. # in production environments by default.
  7. group :assets do
  8. gem 'sass-rails','~> 3.1.0'
  9. gem 'coffee-rails','~> 3.1.0'
  10. gem 'uglifier','>= 1.0.3'
  11. end

然后我运行rake任务来预编译资产

  1. rake assets:precompile

这失败,出现以下错误

  1. Invalid CSS after ".inputs-list li+": expected number or function,was "li"

CSS在引导程序文件中(“.inputs-list li li”是选择器).

但是,如果我跑

  1. rake assets:precompile RAILS_ENV=development

现在它工作正常.事实证明,如果我将config / environments / production.rb更改为不压缩文件

  1. config.assets.compress = false

那么原始命令也可以工作(没有指定开发环境).

那么,我该如何追踪错误?我现在可以忍受只是关闭压缩,但显然有些不对劲.是Rails吗?链轮?ruby赛车? Uglifier?

解决方法

我使用非缩小版的Bootstrap修复了这个问题.在运行rake资产时它仍然会被编译:预编译所以它不是问题:)

猜你在找的CSS相关文章