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

后端 未结 3 1532
情深已故
情深已故 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.

提交回复
热议问题