Compass Extensions are Easy
If you’ve ever taken the time to read the documentation on compass extensions you’ve probably been a little overwhelmed by it. Compass extensions are powerful – an extension can provide:
- Stylesheet libraries
- Project templates & patterns that can install front-end assets into the user’s project.
- Integration with an application framework (Ruby based or otherwise).
- Custom ruby-based sass functions.
- New command line subcommands.
- New configuration options.
All I want to do is share some stylesheets!
But you don’t have to do any of that fancy stuff. This should be easy – and it is! Just follow these 5 simple steps:
Make a directory with the name of your extension, create a subdirectory named
stylesheetsand put your stylesheets in there:
mkdir -p my_awesome_extension/stylesheets cp -r my_project/sass/utilities/* my_awesome_extension/stylesheets
Create an archive of your extension:
tar -zcvf my_awesome_extension-0.1.0.tar.gz my_awesome_extension
Post your extension online somewhere.
Download/Copy the extension and unpack it into your project’s extensions directory:
mkdir extensions # rails projects should use vendor/plugins/compass_extensions cd extensions # download or copy the extension to this folder tar -zxvf my_awesome_extension-0.1.0.tar.gz rm my_awesome_extension-0.1.0.tar.gz
You can now import your extension’s stylesheets:
That’s it. Sorry if I made it sound hard! You don’t even have to make an archive file. You could simply create a git repo and clone it when you need it – any way that gets the extension files into the project’s extensions directory.