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
Nanoc3::Filter::TMP_BINARY_ITEMS_DIR
Class Attribute Summary collapse
-
.current ⇒ Object
The current filter.
Attributes inherited from Nanoc3::Filter
Instance Method Summary collapse
- #imported_filename_to_item(filename) ⇒ Object
-
#run(content, params = {}) ⇒ String
Runs the content through [Sass](sass-lang.com/).
Methods inherited from Nanoc3::Filter
#depend_on, #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
.current ⇒ Object
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
#imported_filename_to_item(filename) ⇒ Object
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 |
#run(content, params = {}) ⇒ String
Runs the content through [Sass](sass-lang.com/). 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 |