Skip to content

Instantly share code, notes, and snippets.

@chriseppstein
Created October 13, 2013 18:19
Show Gist options
  • Save chriseppstein/6965538 to your computer and use it in GitHub Desktop.
Save chriseppstein/6965538 to your computer and use it in GitHub Desktop.
How to write your own application integration so that compass extensions can integrate with a custom application structure.
module MyAppIntegration
extend self
class Installer < Compass::Installers::ManifestInstaller
def completed_configuration
@completed_configuration ||= MyAppIntegration.configuration
end
# do special install stuff here
# like installing package manifests, etc.
def write_configuration_files
super
end
def install_stylesheet(from, to, options)
super(from, to, options)
end
end
module ConfigurationDefaults
def default_javascripts_dir
"js"
end
def default_sass_dir
"sass"
end
def default_css_dir
"css"
end
def default_fonts_dir
"fonts"
end
end
def installer(*args)
Installer.new(*args)
end
def configuration
Compass::Configuration::Data.new('my_app_integration').
extend(ConfigurationDefaults)
end
end
Compass::AppIntegration.register(:my_app_integration, "MyApp")

Assuming this is distributed as a ruby gem

gem install my_app_integration
compass init -r my_app_integration my_app_integration path/to/application
@chriseppstein
Copy link
Author

And if your ruby gem has a file in the lib directory named "compass-*.rb" then it will be auto required -- no need to pass the -r option to compass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment