Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Task for compiling Less

  • Loading branch information...
commit b6d901ae75aa1367f06962e9973579b2d022d506 1 parent 162a85d
@pfig authored
Showing with 24 additions and 1 deletion.
  1. +24 −1 Rakefile
View
25 Rakefile
@@ -2,15 +2,21 @@ require "rubygems"
require 'rake'
require 'yaml'
require 'time'
+require 'less'
SOURCE = "."
+LESS = File.join(SOURCE, "assets", "themes", "twitter") # set theme here
CONFIG = {
'version' => "0.2.9",
'themes' => File.join(SOURCE, "_includes", "themes"),
'layouts' => File.join(SOURCE, "_layouts"),
'posts' => File.join(SOURCE, "_posts"),
'post_ext' => "md",
- 'theme_package_version' => "0.1.0"
+ 'theme_package_version' => "0.1.0",
+ 'less' => File.join(LESS, "less"),
+ 'css' => File.join(LESS, "css"),
+ 'input' => "style.less",
+ 'output' => "style.css"
}
# Path configuration helper
@@ -98,6 +104,23 @@ task :preview do
system "jekyll --auto --server"
end # task :preview
+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
+
# Public: Alias - Maintains backwards compatability for theme switching.
task :switch_theme => "theme:switch"
Please sign in to comment.
Something went wrong with that request. Please try again.