Rake assets:precompile issue. Invalid UTF-8 byte sequence

后端 未结 3 1517
情深已故
情深已故 2021-01-12 00:31

Rails 3.1. I\'m trying to precompile assets.

$ rake assets:precompile RAILS_ENV=production
  rake aborted!
  /home/user/project/public/assets/jquery-ui.min-0         


        
相关标签:
3条回答
  • 2021-01-12 00:33

    This problem appears to be related to Heroku, Sprockets and interpreting non-ascii characters in your stylesheets.

    On the first line of your top-level stylesheet, include:

    @charset "UTF-8";

    The charset directive must be at the top, or heroku's precompile will insert

    @charset "US-ASCII";

    Please note that if you're using manifests in your top-level stylesheet, you can't use the charset directive as well, since both of them want to be on the first line. My workaround is to include the stylesheets that have non-ascii characters separately in my layout (and not as part of the manifest).

    I'd love a better answer than this workaround.

    0 讨论(0)
  • 2021-01-12 00:44

    This is an issue with Sprockets. You can fix this for now by removing the umlaut from "a" in the author's name in the comments. Old:

    Copyright (c) 2010 - 2011 Johan Säll Larsson
    

    New:

    Copyright (c) 2010 - 2011 Johan Sall Larsson
    
    0 讨论(0)
  • 2021-01-12 00:46

    https://github.com/sstephenson/sprockets/issues/219

    config.assets.precompile = %w( files )
    

    instead of

    config.assets.precompile += %w( files )
    

    or

    config.assets.precompile << %w( files )
    
    0 讨论(0)
提交回复
热议问题