public
Last active

For use with Jekyll. Create the directory _plugins in your Jekyll site. Also, in your less file, add two lines of --- at the top.

  • Download Gist
less_converter.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
module Jekyll
class LessConverter < Converter
safe true
priority :high
def setup
return if @setup
require 'less'
@setup = true
rescue LoadError
STDERR.puts 'You are missing the library required for less. Please run:'
STDERR.puts ' $ [sudo] gem install less'
raise FatalException.new("Missing dependency: less")
end
def matches(ext)
ext =~ /less|lcss/i
end
def output_ext(ext)
".css"
end
def convert(content)
setup
begin
Less::Engine.new(content).to_css
rescue => e
puts "Less Exception: #{e.message}"
end
end
end
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.