开发者

How to configure Rails Assets pipeline to use Formtastic's css

app/assets/stylesheets/application.css

*= require formtastic

I get this error:

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...]

So the rake task doesn't work, but strangely when I run the app in development the assets are compiled since I can see the formtastic css being applied.

What am I doing wrong?

Edit:

/*
 * 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_tr开发者_运维百科ee . 
 *= require formtastic
 *= require my_formtastic_changes
*/


Is that line inside a comment group? It should be:

/*
*= require formtastic
*/

I don't think development mode compiles the files, but rather serves them separately, so that may explain why there's no error at that time...


Just want to add to the answer in case anyone else has the same problem.

I had this: wrong

/*= require reset
 *= require main
 */

But I needed to change the first line: right

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜