Posted By

brettbergeron on 08/24/09


Tagged

css rails ruby unix linux less


Versions (?)

Rake Task for Compiling Less Sheets in Rails Directory


 / Published in: Ruby
 

URL: http://brettbergeron.com

Code for a Rake task that allows compiles all LESS stylesheets (.less) contained within a single directory.

  1. desc "Compiles all .less files in the stylesheets directory of a Rails application"
  2. task :less do
  3.  
  4. require 'less'
  5.  
  6. directory = 'public/stylesheets/'
  7. stylesheets = Dir.entries(directory)
  8.  
  9. stylesheets.each do |sheet|
  10. if(File.extname(sheet) == ".less")
  11. `lessc #{directory + sheet}`
  12. end
  13. end
  14. end

Report this snippet  

You need to login to post a comment.