Skip to content

Commit

Permalink
Inject Sass filter instance into Sass::Engine initialize options hash
Browse files Browse the repository at this point in the history
  • Loading branch information
gpakosz committed Apr 18, 2013
1 parent 09f973f commit 749e2f2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
8 changes: 1 addition & 7 deletions lib/nanoc/filters/sass.rb
Expand Up @@ -5,12 +5,6 @@ class Sass < Nanoc::Filter

requires 'sass', 'nanoc/filters/sass/sass_filesystem_importer'

class << self
# The current filter. This is definitely going to bite me if I ever get
# to multithreading nanoc.
attr_accessor :current
end

# Runs the content through [Sass](http://sass-lang.com/).
# Parameters passed to this filter will be passed on to Sass.
#
Expand All @@ -35,8 +29,8 @@ def run(content, params={})
end

# Render
options[:nanoc_current_filter] = self
engine = ::Sass::Engine.new(content, options)
self.class.current = self
engine.render
end

Expand Down
2 changes: 1 addition & 1 deletion lib/nanoc/filters/sass/sass_filesystem_importer.rb
Expand Up @@ -13,7 +13,7 @@ def _find(dir, name, options)
full_filename, syntax = ::Sass::Util.destructure(find_real_file(dir, name, options))
return unless full_filename && File.readable?(full_filename)

filter = Nanoc::Filters::Sass.current # FIXME ew global
filter = options[:nanoc_current_filter]
item = filter.imported_filename_to_item(full_filename)
filter.depend_on([ item ]) unless item.nil?

Expand Down

0 comments on commit 749e2f2

Please sign in to comment.