Skip to content

Instantly share code, notes, and snippets.

@KBalderson
Created June 1, 2013 03:47
Show Gist options
  • Save KBalderson/5689220 to your computer and use it in GitHub Desktop.
Save KBalderson/5689220 to your computer and use it in GitHub Desktop.
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
parser = Less::Parser.new
parser = parser.parse(content).to_css
rescue => e
puts "Less Exception: #{e.message}"
end
end
end
end
@martin-wintz
Copy link

@helenvholmes @import works fine for me. You just need to point them to the right place (probably 'css/style.less')

@andrezimpel
Copy link

Sorry, what do I have to do to get this working?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment