Rake Task for Compiling Less Sheets in Rails Directory


/ Published in: Ruby
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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

URL: http://brettbergeron.com

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.