rstacruz / sinatra-assetpack

Package your assets transparently in Sinatra.
http://ricostacruz.com/sinatra-assetpack/
MIT License
542 stars 97 forks source link

How do I disable compression when in development mode? #175

Open CVertex opened 9 years ago

CVertex commented 9 years ago

Excuse the newbie question. Inside of assets , as per docs I've specified compression for both js and css like so:

js_compression  :jsmin
css_compression :simple

It's useful for debugging that compression be disabled during dev.

How do I disable compression when the environment is development?

Thanks in advance.

rstacruz commented 9 years ago

try this:

assets {
  # rest of your config here
}

configure :production do
  assets {
    js_compression :jsmin
  }
end
CVertex commented 9 years ago

Thanks! That works for js. If I leave off the css_compression for non-production, it's doing compression anyway. Any ideas?

CVertex commented 9 years ago

I'm trying my hand at understanding the engines built-in. All the css compressors seem to do something. There isn't a "simple" compressor that does no transformation

CVertex commented 9 years ago

Ok, I tried writing my own dumb engine, like so:

class NoneEngine < Sinatra::AssetPack::Engine
  def css(str, options={})
    str
  end
end

Sinatra::AssetPack::Compressor.register :css, :none, NoneEngine

then declaring

css_compression :none

But that still compresses my CSS :( I'm confused