Description
http://compass-style.org/help/tutorials/extending/#adding-configuration-properties
When developing a compass extension it's not easy to create new configuration variables. The available documentation is vague (to me) and it appears that this feature simply doesn't work (based on what I've tried).
Take this example config file:
# Require any additional compass plugins here.
Compass::Configuration.add_configuration_property(:foobar, "this is a foobar") do
if environment == :production
"foo"
else
"bar"
end
end
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "stylesheets"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "javascripts"
foobar = "baz" # set my new custom property
puts Compass.configuration.foobar #-> bar
puts Compass.configuration.read(:foobar) #-> bar
puts foobar #-> baz
puts Compass.configuration.set?(:foobar) || false #-> false
puts Compass.configuration.read_without_default(:foobar) || "<not set>" #-> <not set>
The configuration variable is correctly created on the Compass.configure
instance but the value in the config file is never getting picked up or properly processed. This is not what I was expecting. I'm not sure how to access that variable and the documentation doesn't make this process clear.
What is the proper way to create a new property that will exist on the Compass.configuration
instance and will also read from the config file?