Class: Nutils::Filters::Sass
- Inherits:
-
Nanoc3::Filters::Sass
- Object
- Nanoc3::Filters::Sass
- Nutils::Filters::Sass
- Defined in:
- lib/nutils/filters/sass.rb
Constant Summary collapse
- FILES =
[]
Instance Method Summary collapse
- #notify(filename) ⇒ Object
-
#run(content, params = {}) ⇒ String
Runs the content through [Sass](sass-lang.com/).
Instance Method Details
#notify(filename) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/nutils/filters/sass.rb', line 40 def notify(filename) pathname = Pathname.new(filename) item = @items.find { |i| i[:content_filename] && Pathname.new(i[:content_filename]).realpath == pathname.realpath } unless item.nil? # Notify ::Nanoc3::NotificationCenter.post(:visit_started, item) ::Nanoc3::NotificationCenter.post(:visit_ended, item) # Raise unmet dependency error if item is not yet compiled any_uncompiled_rep = item.reps.find { |r| !r.compiled? } raise ::Nanoc3::Errors::UnmetDependency.new(any_uncompiled_rep) if any_uncompiled_rep 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.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/nutils/filters/sass.rb', line 18 def run(content, params={}) puts "You should use the Sass filter from nanoc 3.1.9 or later. This Sass filter (:zass) is deprecated." # Get options = params.dup sass_filename = [:filename] || (@item && @item[:content_filename]) [:filename] ||= sass_filename [:filesystem_importer] ||= Nutils::Importers::Nanoc # Build engine engine = ::Sass::Engine.new(content, ) output = engine.render until Nutils::Filters::Sass::FILES.empty? filename = Nutils::Filters::Sass::FILES.pop notify(filename) end return output end |