【问题标题】:How to configure Rails Assets pipeline to use Formtastic's css如何配置 Rails 资产管道以使用 Formtastic 的 css
【发布时间】:2011-10-13 12:28:58
【问题描述】:

app/assets/stylesheets/application.css

*= require formtastic

我收到此错误:

rake assets:precompile 
/Users/Nerian/.rvm/rubies/ruby-1.9.3-rc1/bin/ruby /Users/Nerian/.rvm/gems/ruby-1.9.3-rc1@davinci/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
rake aborted!
Invalid CSS after "*": expected "{", was "= require formt..."
  (in /Users/Nerian/Projects/davinci/app/assets/stylesheets/application.css)

Tasks: TOP => assets:precompile:primary
(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [/Users/Nerian/.rvm/rubies/ruby-1.9.3-rc1/b...]

所以 rake 任务不起作用,但奇怪的是,当我在开发中运行应用程序时,资产被编译,因为我可以看到正在应用的 formtastic css。

我做错了什么?

编辑:

/*
 * 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 . 
 *= require formtastic
 *= require my_formtastic_changes
*/

【问题讨论】:

    标签: ruby-on-rails


    【解决方案1】:

    那条线在评论组内吗?应该是:

    /*
    *= require formtastic
    */
    

    我认为开发模式不会编译文件,而是单独提供它们,这样可以解释为什么当时没有错误......

    【讨论】:

    • 它在评论组之外。我现在把它们放在里面,现在它可以工作了:)
    【解决方案2】:

    只是想添加到答案中,以防其他人有同样的问题。

    我有这个:

    /*= require reset
     *= require main
     */
    

    但我需要更改第一行:right

    /*
     *= require reset
     *= require main
     */
    

    【讨论】:

      猜你喜欢
      • 2013-07-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多