Skip to content

Instantly share code, notes, and snippets.

@pfig
Created March 25, 2012 09:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pfig/2192506 to your computer and use it in GitHub Desktop.
Save pfig/2192506 to your computer and use it in GitHub Desktop.
Task to compile LESS in jekyll-bootstrap
#
# Save this in _rake/lessc.rake
#
require 'less'
LESS = File.join(SOURCE, "assets", "themes", "twitter") # set theme here
CONFIG['less'] = File.join(LESS, "less")
CONFIG['css'] = File.join(LESS, "css")
CONFIG['input'] = "style.less"
CONFIG['output'] = "style.css"
desc "Compile Less"
task :lessc do
less = CONFIG['less']
input = File.join( less, CONFIG['input'] )
output = File.join( CONFIG['css'], CONFIG['output'] )
source = File.open( input, "r" ).read
parser = Less::Parser.new( :paths => [less] )
tree = parser.parse( source )
File.open( output, "w+" ) do |f|
f.puts tree.to_css( :compress => true )
end
end # task :lessc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment