Sha256: 882562a6489d0065cc4e1510233a60263e924ef619a369059e5783db29551c99

Contents?: true

Size: 563 Bytes

Versions: 7

Compression:

Stored size: 563 Bytes

Contents

# encoding: utf-8

module Nanoc3::Filters
  class Less < Nanoc3::Filter

    # Runs the content through [LESS](http://lesscss.org/).
    # This method takes no options.
    #
    # @param [String] content The content to filter
    #
    # @return [String] The filtered content
    def run(content, params={})
      require 'less'

      # Add filename to load path
      $LESS_LOAD_PATH << File.dirname(@item[:content_filename])

      ::Less::Engine.new(content).to_css
    ensure
      # Restore load path
      $LESS_LOAD_PATH.delete_at(-1)
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
nanoc3-3.1.8 lib/nanoc3/filters/less.rb
nanoc3-3.1.7 lib/nanoc3/filters/less.rb
nanoc3-3.1.6 lib/nanoc3/filters/less.rb
nanoc3-3.2.0a3 lib/nanoc3/filters/less.rb
nanoc3-3.1.5 lib/nanoc3/filters/less.rb
nanoc3-3.1.4 lib/nanoc3/filters/less.rb
nanoc3-3.2.0a2 lib/nanoc3/filters/less.rb