Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Css packaging not working in production mode with Padrino #173

Open
sashee opened this issue May 15, 2014 · 0 comments
Open

Css packaging not working in production mode with Padrino #173

sashee opened this issue May 15, 2014 · 0 comments

Comments

@sashee
Copy link

sashee commented May 15, 2014

I have a Padrino app (I don't know if it's important) and I added a css asset. When running in development mode, everything is fine, when running in production, it gives an error:

ArgumentError - unknown encoding name - TEXT/CSS:
        /home/sashee/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-assetpack-0.3.2/lib/sinatra/assetpack/package.rb:112:in `force_encoding'
        /home/sashee/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-assetpack-0.3.2/lib/sinatra/assetpack/package.rb:112:in `block in combined'
        /home/sashee/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-assetpack-0.3.2/lib/sinatra/assetpack/package.rb:108:in `map'
        /home/sashee/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-assetpack-0.3.2/lib/sinatra/assetpack/package.rb:108:in `combined'
        /home/sashee/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-assetpack-0.3.2/lib/sinatra/assetpack/package.rb:94:in `minify'
        /home/sashee/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-assetpack-0.3.2/lib/sinatra/assetpack/class_methods.rb:32:in `block (3 levels) in add_compressed_routes!'
...

I've traced down the error till this:
https://github.com/rstacruz/sinatra-assetpack/blob/master/lib/sinatra/assetpack/package.rb#L112 . Here, the response_encoding is TEXT/CSS, and result.content_type is text/css . I think it should have a charset, and for the javascript files it indeed has.

The workaround I use is to set the utf-8 encoding to every css files:

        app.after do
          if request.url.end_with?('css')
            headers "Content-Type" => "text/css;charset=utf-8"
          end
        end

It's bit of a hack, but it's working this way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant