I\'m trying to extend the Sass:Script::Functions module, per this recommendation: https://gist.github.com/481261/dd07a52829886ab1ad0875a8895f0100c4b925ab. The question is, w
I just solved this to be able to use the compact function from Compass. Here's the whole scoop:
lib/sass.rb (created a new file)
# Compact function pulled from compass
module Sass::Script::Functions
module CustomSassExtensions
def compact(*args)
sep = :comma
if args.size == 1 && args.first.is_a?(Sass::Script::List)
args = args.first.value
sep = args.first.separator
end
Sass::Script::List.new(args.reject{|a| !a.to_bool}, sep)
end
end
include CustomSassExtensions
end
config/application.rb (place this inside inside class Application right after the lines with config.autoload_paths)
if config.respond_to?(:sass)
require "#{config.root}/lib/sass.rb"
end
Let me know if it worked for you.