Class: SassExtractor

Inherits:
Object
  • Object
show all
Defined in:
lib/sass-extractor.rb

Defined Under Namespace

Classes: Extractor, Visitor

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ SassExtractor

Returns a new instance of SassExtractor.



5
6
7
# File 'lib/sass-extractor.rb', line 5

def initialize(options)
  @options = options
end

Instance Method Details

#get_rules(file_name) ⇒ Object



9
10
11
# File 'lib/sass-extractor.rb', line 9

def get_rules(file_name)
  Extractor.new(sass_tree_for_file(file_name)).get_rules(prefixes)
end

#prefixesObject



18
# File 'lib/sass-extractor.rb', line 18

def prefixes; @options[:prefixes] || [""] end

#sass_optionsObject



17
# File 'lib/sass-extractor.rb', line 17

def sass_options; @options[:sass_options] end

#sass_tree_for_file(file_name) ⇒ Object



13
14
15
# File 'lib/sass-extractor.rb', line 13

def sass_tree_for_file(file_name)
  Sass::Engine.for_file(file_name, sass_options).to_tree
end