rstacruz/sinatra-assetpack — Issue #35: AssetPack config does not survive classy app inheritance
Author: kyledrake
Created: 2012-01-26 22:51:49+00:00
State: open

Given a class:

class App < Sinatra::Base
register Sinatra::AssetPack
assets {
serve '/js', from: 'assets/js'
serve '/css', from: 'assets/css'
serve '/images', from: 'assets/img'

js :main_js, [
'/js/plugin.js',
'/js/application.js'
]

css :main_css, [
'/css/reset.css',
'/css/style.css'
]

# Set Compressors
js_compression :yui, :munge => true
css_compression :sass

# Prebuild assets in prodctions
prebuild ENV['RACK_ENV'] == 'production'

}
end

Any inherited classes do not receive the config values:

class Widget < App
end

My current workaround is to re-load the config for each class, but it would be better if it was able to inherit the properties from the parent class. I have no found a solution for this yet, but I thought I'd post this incase it was an obvious fix to somebody.