Created
March 25, 2012 09:09
-
-
Save pfig/2192506 to your computer and use it in GitHub Desktop.
Task to compile LESS in jekyll-bootstrap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 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