I was searching for how to include sass mixins in Sprockets projects as a gem dependency. There may be some way to do it but I couldn’t figure it out. That’s why I ended up going for a Compass extension, since I use Compass anyway.
Create the compass extension:
compass create pixie_sass --using compass/extension
Remove the templates directory
rm -rf pixie_sass/templates
bundle gem pixie_sass
Add compass as a gem dependency:
Move the stylesheets folder to be within lib.
Register the plugin in lib/pixie_sass.rb
base_directory = File.join(File.dirname(__FILE__))
Compass::Frameworks.register('pixie_sass', :path => base_directory)
Add your sass files and mixins.
Push to github.
Require the gem in your other projects:
gem "pixie_sass", :git => "git://github.com/PixieEngine/pixie_sass"
2 thoughts on “How to Create a Compass Extension as a RubyGem to Share Sass Mixins”
Thank you, this helped me a lot!