Class: Nanoc3::Filters::Sass
- Inherits:
-
Nanoc3::Filter
- Object
- Context
- Nanoc3::Filter
- Nanoc3::Filters::Sass
- Defined in:
- lib/nanoc3/filters/sass.rb
Defined Under Namespace
Classes: SassFilesystemImporter
Constant Summary
Constants inherited from Nanoc3::Filter
Class Attribute Summary (collapse)
-
+ (Object) current
The current filter.
Attributes inherited from Nanoc3::Filter
Instance Method Summary (collapse)
- - (Object) depend_on(items)
- - (Object) imported_filename_to_item(filename)
-
- (String) run(content, params = {})
Runs the content through Sass.
Methods inherited from Nanoc3::Filter
#filename, from_binary?, #initialize, #output_filename, to_binary?, type
Methods included from PluginRegistry::PluginMethods
#identifier, #identifiers, #named, #register
Methods inherited from Context
Constructor Details
This class inherits a constructor from Nanoc3::Filter
Class Attribute Details
+ (Object) current
The current filter. This is definitely going to bite me if I ever get to multithreading nanoc.
12 13 14 |
# File 'lib/nanoc3/filters/sass.rb', line 12 def current @current end |
Instance Method Details
- (Object) depend_on(items)
TODO:
Remove me in nanoc 3.2.x
66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/nanoc3/filters/sass.rb', line 66 def depend_on(items) # Notify items.each do |item| Nanoc3::NotificationCenter.post(:visit_started, item) Nanoc3::NotificationCenter.post(:visit_ended, item) end # Raise unmet dependency error if necessary items.each do |item| rep = item.reps.find { |r| !r.compiled? } raise Nanoc3::Errors::UnmetDependency.new(rep) if rep end end |
- (Object) imported_filename_to_item(filename)
57 58 59 60 61 62 63 |
# File 'lib/nanoc3/filters/sass.rb', line 57 def imported_filename_to_item(filename) path = Pathname.new(filename).realpath @items.find do |i| next if i[:content_filename].nil? Pathname.new(i[:content_filename]).realpath == path end end |
- (String) run(content, params = {})
Runs the content through Sass. Parameters passed to this filter will be passed on to Sass.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/nanoc3/filters/sass.rb', line 42 def run(content, params={}) # Build options = params.dup sass_filename = [:filename] || (@item && @item[:content_filename]) [:filename] ||= sass_filename [:filesystem_importer] ||= Nanoc3::Filters::Sass::SassFilesystemImporter # Render engine = ::Sass::Engine.new(content, ) self.class.current = self engine.render end |